Make sure update-score removes a score if all references to it are popped

This commit is contained in:
zkldi
2021-12-09 13:13:25 +00:00
parent e884de6077
commit a364f23cd3
@@ -75,8 +75,11 @@ export default async function UpdateScore(oldScore: ScoreDocument, newScore: Sco
);
} catch (err) {
logger.warn(
`Score ID ${newScoreID} already existed -- this update caused a collision. Updating old references anyway.`
`Score ID ${newScoreID} already existed -- this update caused a collision. Removing old score and updating old references anyway.`
);
await db.scores.remove({
scoreID: oldScoreID,
});
}
const sessions = await db.sessions.find({