Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename the ranks to a more legible system #963

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 14 additions & 16 deletions src/calculateRank.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ function calculateRank({
REPO_OFFSET;

const RANK_S_VALUE = 1;
const RANK_DOUBLE_A_VALUE = 25;
const RANK_A2_VALUE = 45;
const RANK_A3_VALUE = 60;
const RANK_B_VALUE = 100;
const RANK_A_VALUE = 25;
const RANK_B_VALUE = 45;
const RANK_C_VALUE = 60;
const RANK_D_VALUE = 100;

const TOTAL_VALUES =
RANK_S_VALUE + RANK_A2_VALUE + RANK_A3_VALUE + RANK_B_VALUE;
RANK_S_VALUE + RANK_B_VALUE + RANK_C_VALUE + RANK_D_VALUE;

// prettier-ignore
const score = (
Expand All @@ -66,25 +66,23 @@ function calculateRank({
let level = "";

if (normalizedScore < RANK_S_VALUE) {
level = "S+";
level = "S";
}
if (
normalizedScore >= RANK_S_VALUE &&
normalizedScore < RANK_DOUBLE_A_VALUE
normalizedScore >= RANK_S_VALUE && normalizedScore < RANK_A_VALUE
) {
level = "S";
level = "A";
}
if (
normalizedScore >= RANK_DOUBLE_A_VALUE &&
normalizedScore < RANK_A2_VALUE
normalizedScore >= RANK_A_VALUE && normalizedScore < RANK_B_VALUE
) {
level = "A++";
level = "B";
}
if (normalizedScore >= RANK_A2_VALUE && normalizedScore < RANK_A3_VALUE) {
level = "A+";
if (normalizedScore >= RANK_B_VALUE && normalizedScore < RANK_C_VALUE) {
level = "C";
}
if (normalizedScore >= RANK_A3_VALUE && normalizedScore < RANK_B_VALUE) {
level = "B+";
if (normalizedScore >= RANK_C_VALUE && normalizedScore < RANK_D_VALUE) {
level = "D";
}

return { level, score: normalizedScore };
Expand Down