diff --git a/lib/plausible/ingestion/request.ex b/lib/plausible/ingestion/request.ex index f557cdde4..a23352527 100644 --- a/lib/plausible/ingestion/request.ex +++ b/lib/plausible/ingestion/request.ex @@ -37,7 +37,7 @@ defmodule Plausible.Ingestion.Request do |> Changeset.change() |> Changeset.put_change( :timestamp, - NaiveDateTime.utc_now() + NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second) ) case parse_body(conn) do diff --git a/test/plausible_web/controllers/stats_controller_test.exs b/test/plausible_web/controllers/stats_controller_test.exs index 71156ef1a..23b9a4c0e 100644 --- a/test/plausible_web/controllers/stats_controller_test.exs +++ b/test/plausible_web/controllers/stats_controller_test.exs @@ -191,7 +191,8 @@ defmodule PlausibleWeb.StatsControllerTest do subdivision1_code: "EE-37", city_geoname_id: 588_409, pathname: "/", - timestamp: Timex.shift(~N[2021-10-20 12:00:00], minutes: -1), + timestamp: + Timex.shift(~N[2021-10-20 12:00:00], minutes: -1) |> NaiveDateTime.truncate(:second), referrer_source: "Google", user_id: 123 ), @@ -200,7 +201,8 @@ defmodule PlausibleWeb.StatsControllerTest do subdivision1_code: "EE-37", city_geoname_id: 588_409, pathname: "/some-other-page", - timestamp: Timex.shift(~N[2021-10-20 12:00:00], minutes: -2), + timestamp: + Timex.shift(~N[2021-10-20 12:00:00], minutes: -2) |> NaiveDateTime.truncate(:second), referrer_source: "Google", user_id: 123 ), @@ -211,23 +213,27 @@ defmodule PlausibleWeb.StatsControllerTest do utm_source: "google", utm_content: "content", utm_term: "term", - timestamp: Timex.shift(~N[2021-10-20 12:00:00], days: -1), + timestamp: + Timex.shift(~N[2021-10-20 12:00:00], days: -1) |> NaiveDateTime.truncate(:second), browser: "ABrowserName" ), build(:pageview, - timestamp: Timex.shift(~N[2021-10-20 12:00:00], months: -1), + timestamp: + Timex.shift(~N[2021-10-20 12:00:00], months: -1) |> NaiveDateTime.truncate(:second), country_code: "EE", browser: "ABrowserName" ), build(:pageview, - timestamp: Timex.shift(~N[2021-10-20 12:00:00], months: -5), + timestamp: + Timex.shift(~N[2021-10-20 12:00:00], months: -5) |> NaiveDateTime.truncate(:second), utm_campaign: "ads", country_code: "EE", referrer_source: "Google", browser: "ABrowserName" ), build(:event, - timestamp: Timex.shift(~N[2021-10-20 12:00:00], days: -1), + timestamp: + Timex.shift(~N[2021-10-20 12:00:00], days: -1) |> NaiveDateTime.truncate(:second), name: "Signup", "meta.key": ["variant"], "meta.value": ["A"]