diff --git a/backend/handlers/pb.js b/backend/handlers/pb.js index 94826ccfe..7a31e3415 100644 --- a/backend/handlers/pb.js +++ b/backend/handlers/pb.js @@ -96,6 +96,17 @@ module.exports = { }); } + let topIndex = 0; + let topWpm = 0; + obj[mode][mode2].forEach((pb, index) => { + delete pb.best; + if (pb.wpm > topWpm) { + topIndex = index; + topWpm = pb.wpm; + } + }); + obj[mode][mode2][topIndex].best = true; + return { isPb, obj,