Skip to content

Commit

Permalink
update of pr
Browse files Browse the repository at this point in the history
  • Loading branch information
chralp committed Sep 26, 2020
1 parent 521669a commit d86381d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@ const getScoreBoard = async (listType: string, scoreType: string) => {
if(enableLevel) {
const levelScoreList = scoreList.map(x => {
let score = x.score;
const threshold: number = scoreRotation;
const roundedScore = Math.floor( score / threshold ) * threshold;
const level = Math.floor((score -1) / threshold)
const newScore = ((score - roundedScore) === 0 ? roundedScore - (score - threshold) : score - roundedScore);
const roundedScore = Math.floor( score / scoreRotation ) * scoreRotation;
const level = Math.floor((score -1) / scoreRotation);
const newScore = ((score - roundedScore) === 0 ? roundedScore - (score - scoreRotation) : score - roundedScore);
return {
_id: x._id,
score: newScore,
level
level,
}
});
return sort(mapper(levelScoreList));
Expand Down

0 comments on commit d86381d

Please sign in to comment.