From ead765d57a9cb10d1a8a2713e897a236094bbd97 Mon Sep 17 00:00:00 2001 From: Miodec Date: Wed, 7 Feb 2024 09:28:54 +0100 Subject: [PATCH] fix(server): only saving isPb property in the database if the result was a pb this was the previous behaviour but #4980 broke it --- backend/src/utils/result.ts | 1 + shared-types/types.d.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/backend/src/utils/result.ts b/backend/src/utils/result.ts index ddccc2fd3342..b6dd0ad5a658 100644 --- a/backend/src/utils/result.ts +++ b/backend/src/utils/result.ts @@ -55,6 +55,7 @@ export function buildDbResult( if (ce.incompleteTestSeconds === 0) delete res.incompleteTestSeconds; if (ce.afkDuration === 0) delete res.afkDuration; if (ce.tags.length === 0) delete res.tags; + if (ce.isPb === false) delete res.isPb; if (ce.keySpacingStats === undefined) delete res.keySpacingStats; if (ce.keyDurationStats === undefined) delete res.keyDurationStats; diff --git a/shared-types/types.d.ts b/shared-types/types.d.ts index fbf3e064962e..d33aa42c0cf5 100644 --- a/shared-types/types.d.ts +++ b/shared-types/types.d.ts @@ -219,6 +219,7 @@ declare namespace SharedTypes { | "incompleteTests" | "customText" | "quoteLength" + | "isPb" > & { correctChars?: number; // -------------- incorrectChars?: number; // legacy results @@ -239,6 +240,7 @@ declare namespace SharedTypes { tags?: string[]; customText?: CustomText; quoteLength?: number; + isPb?: boolean; } >;