fix: Fallback to the last user level
This commit is contained in:
parent
15f05978a9
commit
6a8f0d1594
@ -47,9 +47,5 @@ export const UserLevels: IUserLevel[] = [
|
|||||||
|
|
||||||
export function userScoreToLevel(userScore: number): IUserLevel {
|
export function userScoreToLevel(userScore: number): IUserLevel {
|
||||||
// NOTE: The failure level should never be returned
|
// NOTE: The failure level should never be returned
|
||||||
return UserLevels.find((el) => userScore < el.levelCap) || {
|
return UserLevels.find((el) => userScore < el.levelCap) || UserLevels[UserLevels.length - 1];
|
||||||
level: 0,
|
|
||||||
name: "Failure",
|
|
||||||
levelCap: 10000000,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user