From 73f80229924e60a3c7886dcb89f2f25fac483774 Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 30 Sep 2024 14:08:46 +0200 Subject: [PATCH] impr(backend): consider incomplete tests when checking result spacing !nuf --- backend/src/api/controllers/result.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/src/api/controllers/result.ts b/backend/src/api/controllers/result.ts index c964cb371..5ca243d27 100644 --- a/backend/src/api/controllers/result.ts +++ b/backend/src/api/controllers/result.ts @@ -276,6 +276,8 @@ export async function addResult( ) { const status = MonkeyStatusCodes.RESULT_DATA_INVALID; throw new MonkeyError(status.code, "Result data doesn't make sense"); + } else if (isDevEnvironment()) { + Logger.success("Result data validated"); } } else { if (!isDevEnvironment()) { @@ -311,7 +313,9 @@ export async function addResult( //check if now is earlier than last result plus duration (-1 second as a buffer) const testDurationMilis = completedEvent.testDuration * 1000; - const earliestPossible = (lastResultTimestamp ?? 0) + testDurationMilis; + const incompleteTestsMilis = completedEvent.incompleteTestSeconds * 1000; + const earliestPossible = + (lastResultTimestamp ?? 0) + testDurationMilis + incompleteTestsMilis; const nowNoMilis = Math.floor(Date.now() / 1000) * 1000; if (lastResultTimestamp && nowNoMilis < earliestPossible - 1000) { void addLog(