Skip to content

Commit 161c037

Browse files
committed
fix try 300
1 parent 7315d45 commit 161c037

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

app/jobs/leaderboard_update_job.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def build_global(date, period)
3434
board = ::Leaderboard.find_or_create_by!(
3535
start_date: date,
3636
period_type: period,
37-
timezone_offset: nil
37+
timezone_utc_offset: nil
3838
) do |lb|
3939
lb.finished_generating_at = nil
4040
end
@@ -82,14 +82,14 @@ def build_global(date, period)
8282
def build_timezones(date, period)
8383
range = LeaderboardDateRange.calculate(date, period)
8484

85-
active_timezones = User.joins(:heartbeats)
86-
.where(heartbeats: { time: range })
87-
.where.not(timezone: nil)
88-
.distinct
89-
.pluck(:timezone)
90-
.compact
85+
user_timezones = User.joins(:heartbeats)
86+
.where(heartbeats: { time: range })
87+
.where.not(timezone: nil)
88+
.distinct
89+
.pluck(:timezone)
90+
.compact
9191

92-
offsets = active_timezones.map { |tz| User.timezone_to_utc_offset(tz) }.compact.uniq
92+
offsets = user_timezones.map { |tz| User.timezone_to_utc_offset(tz) }.compact.uniq
9393

9494
Rails.logger.info "Generating timezone leaderboards for #{offsets.size} active UTC offsets"
9595

app/services/leaderboard_service.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def get_global(date, period)
3939
board = LeaderboardCache.read(key)
4040
return board if board.present?
4141
board = ::Leaderboard.where.not(finished_generating_at: nil)
42-
.find_by(start_date: date, period_type: period, timezone_offset: nil, deleted_at: nil)
42+
.find_by(start_date: date, period_type: period, timezone_utc_offset: nil, deleted_at: nil)
4343

4444
if board.present?
4545
LeaderboardCache.write(key, board)

0 commit comments

Comments
 (0)