File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -402,7 +402,7 @@ export async function addResult(
402402 }
403403
404404 if ( req . ctx . configuration . users . lastHashesCheck . enabled ) {
405- let lastHashes = user . lastReultHashes ?? [ ] ;
405+ let lastHashes = user . lastResultHashes ?? user . lastReultHashes ?? [ ] ;
406406 if ( lastHashes . includes ( resulthash ) ) {
407407 void addLog (
408408 "duplicate_result" ,
Original file line number Diff line number Diff line change @@ -509,7 +509,8 @@ type RelevantUserInfo = Omit<
509509 | "nameHistory"
510510 | "lastNameChange"
511511 | "_id"
512- | "lastReultHashes" //TODO fix typo
512+ | "lastResultHashes"
513+ | "lastReultHashes"
513514 | "note"
514515 | "ips"
515516 | "testActivity"
@@ -524,7 +525,8 @@ function getRelevantUserInfo(user: UserDAL.DBUser): RelevantUserInfo {
524525 "nameHistory" ,
525526 "lastNameChange" ,
526527 "_id" ,
527- "lastReultHashes" , //TODO fix typo
528+ "lastResultHashes" ,
529+ "lastReultHashes" ,
528530 "note" ,
529531 "ips" ,
530532 "testActivity" ,
Original file line number Diff line number Diff line change @@ -589,7 +589,10 @@ export async function updateLastHashes(
589589 { uid } ,
590590 {
591591 $set : {
592- lastReultHashes : lastHashes , //TODO fix typo
592+ lastResultHashes : lastHashes ,
593+ } ,
594+ $unset : {
595+ lastReultHashes : 1 ,
593596 } ,
594597 } ,
595598 ) ;
Original file line number Diff line number Diff line change @@ -243,7 +243,8 @@ export const UserSchema = z.object({
243243 uid : z . string ( ) , //defined by firebase, no validation should be applied
244244 addedAt : z . number ( ) . int ( ) . nonnegative ( ) ,
245245 personalBests : PersonalBestsSchema ,
246- lastReultHashes : z . array ( z . string ( ) ) . optional ( ) , //TODO: fix typo (it's in the db too)
246+ lastResultHashes : z . array ( z . string ( ) ) . optional ( ) ,
247+ lastReultHashes : z . array ( z . string ( ) ) . optional ( ) , //legacy typo, kept for backwards compatibility
247248 completedTests : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
248249 startedTests : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
249250 timeTyping : z
You can’t perform that action at this time.
0 commit comments