fix(server): only saving isPb property in the database if the result was a pb

this was the previous behaviour but  broke it
This commit is contained in:
Miodec 2024-02-07 09:28:54 +01:00
parent 6c1c22787d
commit ead765d57a
2 changed files with 3 additions and 0 deletions
backend/src/utils
shared-types

View file

@ -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;

View file

@ -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;
}
>;