diff --git a/src/calculateRank.js b/src/calculateRank.js index 0c401d9..9a8a55d 100644 --- a/src/calculateRank.js +++ b/src/calculateRank.js @@ -65,10 +65,10 @@ function calculateRank({ const level = (() => { if (normalizedScore < RANK_S_VALUE) return "S+"; - if (normalizedScore >= RANK_S_VALUE && normalizedScore < RANK_DOUBLE_A_VALUE) return "S"; - if (normalizedScore >= RANK_DOUBLE_A_VALUE && normalizedScore < RANK_A2_VALUE) return "A++"; - if (normalizedScore >= RANK_A2_VALUE && normalizedScore < RANK_A3_VALUE) return "A+" - if (normalizedScore >= RANK_A3_VALUE && normalizedScore < RANK_B_VALUE) return "B+" + if (normalizedScore < RANK_DOUBLE_A_VALUE) return "S"; + if (normalizedScore < RANK_A2_VALUE) return "A++"; + if (normalizedScore < RANK_A3_VALUE) return "A+" + return "B+"; })() return { level, score: normalizedScore }; diff --git a/src/fetchers/stats-fetcher.js b/src/fetchers/stats-fetcher.js index 04b4b3e..2617137 100644 --- a/src/fetchers/stats-fetcher.js +++ b/src/fetchers/stats-fetcher.js @@ -86,15 +86,16 @@ const totalCommitsFetcher = async (username) => { try { let res = await retryer(fetchTotalCommits, { login: username }); - if (res.data.total_count) { + let total_count = res.data.total_count; + if (!!total_count && !isNaN(total_count)) { return res.data.total_count; } } catch (err) { logger.log(err); - // just return 0 if there is something wrong so that - // we don't break the whole app - return 0; } + // just return 0 if there is something wrong so that + // we don't break the whole app + return 0; }; /**