Fix bug of unknown trophy

This commit is contained in:
ryo-ma 2020-08-30 18:39:41 +09:00
parent 66eeb53973
commit 32e060a721
2 changed files with 4 additions and 1 deletions

View file

@ -39,6 +39,9 @@ export class Trophy {
} }
} }
private calculateNextRankPercentage() { private calculateNextRankPercentage() {
if (this.rank === RANK.UNKNOWN) {
return 0;
}
const nextRankIndex = RANK_ORDER.indexOf(this.rank) - 1; const nextRankIndex = RANK_ORDER.indexOf(this.rank) - 1;
// When got the max rank // When got the max rank
if (nextRankIndex < 0 || this.rank === RANK.SSS) { if (nextRankIndex < 0 || this.rank === RANK.SSS) {

View file

@ -10,7 +10,7 @@ export function parseParams(req: ServerRequest): URLSearchParams {
export function abridgeScore(score: number): string { export function abridgeScore(score: number): string {
if (Math.abs(score) < 1) { if (Math.abs(score) < 1) {
return "unknown"; return "0pt";
} }
if (Math.abs(score) > 999) { if (Math.abs(score) > 999) {
return (Math.sign(score) * (Math.abs(score) / 1000)).toFixed(1) + "pt"; return (Math.sign(score) * (Math.abs(score) / 1000)).toFixed(1) + "pt";