fix try 300

This commit is contained in:
Echo
2025-08-08 23:00:50 -04:00
parent 7315d45c52
commit 161c037b6e
2 changed files with 9 additions and 9 deletions

View File

@@ -34,7 +34,7 @@ class LeaderboardUpdateJob < ApplicationJob
board = ::Leaderboard.find_or_create_by!(
start_date: date,
period_type: period,
timezone_offset: nil
timezone_utc_offset: nil
) do |lb|
lb.finished_generating_at = nil
end
@@ -82,14 +82,14 @@ class LeaderboardUpdateJob < ApplicationJob
def build_timezones(date, period)
range = LeaderboardDateRange.calculate(date, period)
active_timezones = User.joins(:heartbeats)
.where(heartbeats: { time: range })
.where.not(timezone: nil)
.distinct
.pluck(:timezone)
.compact
user_timezones = User.joins(:heartbeats)
.where(heartbeats: { time: range })
.where.not(timezone: nil)
.distinct
.pluck(:timezone)
.compact
offsets = active_timezones.map { |tz| User.timezone_to_utc_offset(tz) }.compact.uniq
offsets = user_timezones.map { |tz| User.timezone_to_utc_offset(tz) }.compact.uniq
Rails.logger.info "Generating timezone leaderboards for #{offsets.size} active UTC offsets"

View File

@@ -39,7 +39,7 @@ class LeaderboardService
board = LeaderboardCache.read(key)
return board if board.present?
board = ::Leaderboard.where.not(finished_generating_at: nil)
.find_by(start_date: date, period_type: period, timezone_offset: nil, deleted_at: nil)
.find_by(start_date: date, period_type: period, timezone_utc_offset: nil, deleted_at: nil)
if board.present?
LeaderboardCache.write(key, board)