From 255fd7f4108f64ae59369445859bec96a1d8104d Mon Sep 17 00:00:00 2001 From: Miodec Date: Sat, 19 Jul 2025 02:08:55 +0200 Subject: [PATCH] chore: only log daily changes 6 hours after the reset --- backend/src/api/controllers/result.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/src/api/controllers/result.ts b/backend/src/api/controllers/result.ts index c8274fff7e2c..5656d4e64492 100644 --- a/backend/src/api/controllers/result.ts +++ b/backend/src/api/controllers/result.ts @@ -541,7 +541,12 @@ export async function addResult( dailyLeaderboardRank <= 10 && completedEvent.testDuration <= 120 ) { - await addLog("daily_leaderboard_top_10_result", completedEvent, uid); + const now = Date.now(); + const reset = getCurrentDayTimestamp(); + const limit = 6 * 60 * 60 * 1000; + if (now - reset >= limit) { + await addLog("daily_leaderboard_top_10_result", completedEvent, uid); + } } }