From fe04291af46d7cb9d3439fa73739b2ffb2b53d72 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 4 Sep 2024 13:19:53 -0400 Subject: [PATCH] Use more accurate beginning/ending times in annual report source (#31751) --- app/lib/annual_report/source.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/lib/annual_report/source.rb b/app/lib/annual_report/source.rb index 1ccb622676..d56a1fcccf 100644 --- a/app/lib/annual_report/source.rb +++ b/app/lib/annual_report/source.rb @@ -11,6 +11,16 @@ class AnnualReport::Source protected def year_as_snowflake_range - (Mastodon::Snowflake.id_at(DateTime.new(year, 1, 1))..Mastodon::Snowflake.id_at(DateTime.new(year, 12, 31))) + (beginning_snowflake_id..ending_snowflake_id) + end + + private + + def beginning_snowflake_id + Mastodon::Snowflake.id_at DateTime.new(year).beginning_of_year + end + + def ending_snowflake_id + Mastodon::Snowflake.id_at DateTime.new(year).end_of_year end end