File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ def build_global(date, period)
34
34
board = ::Leaderboard . find_or_create_by! (
35
35
start_date : date ,
36
36
period_type : period ,
37
- timezone_utc_offset : nil
37
+ timezone_offset : nil
38
38
) do |lb |
39
39
lb . finished_generating_at = nil
40
40
end
@@ -82,12 +82,14 @@ def build_global(date, period)
82
82
def build_timezones ( date , period )
83
83
range = LeaderboardDateRange . calculate ( date , period )
84
84
85
- offsets = User . joins ( :heartbeats )
86
- . where ( heartbeats : { time : range } )
87
- . where . not ( timezone_utc_offset : nil )
88
- . distinct
89
- . pluck ( :timezone_utc_offset )
90
- . compact
85
+ active_timezones = User . joins ( :heartbeats )
86
+ . where ( heartbeats : { time : range } )
87
+ . where . not ( timezone : nil )
88
+ . distinct
89
+ . pluck ( :timezone )
90
+ . compact
91
+
92
+ offsets = active_timezones . map { |tz | User . timezone_to_utc_offset ( tz ) } . compact . uniq
91
93
92
94
Rails . logger . info "Generating timezone leaderboards for #{ offsets . size } active UTC offsets"
93
95
You can’t perform that action at this time.
0 commit comments