Skip to content

Commit 255fd7f

Browse files
committed
chore: only log daily changes 6 hours after the reset
1 parent 2a9507a commit 255fd7f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

backend/src/api/controllers/result.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,12 @@ export async function addResult(
541541
dailyLeaderboardRank <= 10 &&
542542
completedEvent.testDuration <= 120
543543
) {
544-
await addLog("daily_leaderboard_top_10_result", completedEvent, uid);
544+
const now = Date.now();
545+
const reset = getCurrentDayTimestamp();
546+
const limit = 6 * 60 * 60 * 1000;
547+
if (now - reset >= limit) {
548+
await addLog("daily_leaderboard_top_10_result", completedEvent, uid);
549+
}
545550
}
546551
}
547552

0 commit comments

Comments
 (0)