Skip to content

Commit c6d9033

Browse files
committed
chore: move result logging later, log top 10 daily
1 parent c4590a2 commit c6d9033

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

backend/src/api/controllers/result.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,6 @@ export async function addResult(
214214
const completedEvent = req.body.result;
215215
completedEvent.uid = uid;
216216

217-
if (user.suspicious && completedEvent.testDuration <= 120) {
218-
await addImportantLog("suspicious_user_result", completedEvent, uid);
219-
}
220-
221217
if (isTestTooShort(completedEvent)) {
222218
const status = MonkeyStatusCodes.TEST_TOO_SHORT;
223219
throw new MonkeyError(status.code, status.message);
@@ -284,6 +280,10 @@ export async function addResult(
284280
};
285281
}
286282

283+
if (user.suspicious && completedEvent.testDuration <= 120) {
284+
await addImportantLog("suspicious_user_result", completedEvent, uid);
285+
}
286+
287287
if (anticheatImplemented()) {
288288
if (
289289
!validateResult(
@@ -536,6 +536,13 @@ export async function addResult(
536536
},
537537
dailyLeaderboardsConfig
538538
);
539+
if (
540+
dailyLeaderboardRank >= 1 &&
541+
dailyLeaderboardRank <= 10 &&
542+
completedEvent.testDuration <= 120
543+
) {
544+
await addLog("daily_leaderboard_top_10_result", completedEvent, uid);
545+
}
539546
}
540547

541548
const streak = await UserDAL.updateStreak(uid, completedEvent.timestamp);

0 commit comments

Comments
 (0)