mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
fix try 300
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user