mirror of
https://github.com/reiyua/github-profile-trophy-reiyua-mirror.git
synced 2026-11-17 06:02:09 +11:00
Add abridgeScore
This commit is contained in:
parent
bc9fe8f59f
commit
e17cfb9bb4
1 changed files with 14 additions and 0 deletions
14
src/utils.ts
14
src/utils.ts
|
|
@ -8,6 +8,18 @@ export function parseParams(req: ServerRequest): URLSearchParams {
|
||||||
return new URLSearchParams(splitedURL[1]);
|
return new URLSearchParams(splitedURL[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function abridgeScore(score: number): string {
|
||||||
|
if (score < 1) {
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
if (Math.abs(score) > 999){
|
||||||
|
return (Math.sign(score) * (Math.abs(score) / 1000)).toFixed(1) + "k+"
|
||||||
|
|
||||||
|
}
|
||||||
|
return (Math.sign(score) * Math.abs(score)).toString().slice(0, -1) + "0+";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
export const CONSTANTS = {
|
export const CONSTANTS = {
|
||||||
CACHE_MAX_AGE: 7200,
|
CACHE_MAX_AGE: 7200,
|
||||||
DEFALT_PANEL_SIZE: 110,
|
DEFALT_PANEL_SIZE: 110,
|
||||||
|
|
@ -16,7 +28,9 @@ export const CONSTANTS = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export enum RANK {
|
export enum RANK {
|
||||||
|
SP = "S+",
|
||||||
S = "S",
|
S = "S",
|
||||||
|
AP = "A+",
|
||||||
A = "A",
|
A = "A",
|
||||||
B = "B",
|
B = "B",
|
||||||
C = "C",
|
C = "C",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue