Fix heartbeats in future from messing with active_user data

This commit is contained in:
Max Wofford
2025-05-05 10:48:14 -04:00
parent 9ba488230f
commit 7ccdc5acd2

View File

@@ -8,6 +8,7 @@ class Cache::ActiveUsersGraphDataJob < Cache::ActivityJob
hours = Heartbeat.coding_only
.with_valid_timestamps
.where("time > ?", 24.hours.ago.to_f)
.where("time < ?", Time.current.to_f)
.select("(EXTRACT(EPOCH FROM to_timestamp(time))::bigint / 3600 * 3600) as hour, COUNT(DISTINCT user_id) as count")
.group("hour")
.order("hour DESC")