Skip to content

Commit 034f47c

Browse files
Refactor constants names for lambdas
1 parent 6f370e3 commit 034f47c

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/calculateRank.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ function calculateRank({
1212
stargazers,
1313
}) {
1414
// value of statistics should be equal to 1 / <average number per user> (see https://en.wikipedia.org/wiki/Exponential_distribution#Mean,_variance,_moments_and_median)
15-
const COMMITS_VALUE = 1 / 10000;
16-
const CONTRIBS_VALUE = 1 / 1000;
17-
const ISSUES_VALUE = 1 / 100;
18-
const STARS_VALUE = 1 / 400;
19-
const PRS_VALUE = 1 / 300;
20-
const FOLLOWERS_VALUE = 1 / 100;
21-
const REPO_VALUE = 1 / 20;
15+
const COMMITS_LAMBDA = 1 / 10000;
16+
const CONTRIBS_LAMBDA = 1 / 1000;
17+
const ISSUES_LAMBDA = 1 / 100;
18+
const STARS_LAMBDA = 1 / 400;
19+
const PRS_LAMBDA = 1 / 300;
20+
const FOLLOWERS_LAMBDA = 1 / 100;
21+
const REPO_LAMBDA = 1 / 20;
2222

2323
const RANK_S_VALUE = 1;
2424
const RANK_DOUBLE_A_VALUE = 25;
@@ -27,13 +27,13 @@ function calculateRank({
2727
const RANK_B_VALUE = 100;
2828

2929
const normalizedScore = 700 / (
30-
1 / expsf(COMMITS_VALUE, totalCommits) +
31-
1 / expsf(CONTRIBS_VALUE, contributions) +
32-
1 / expsf(ISSUES_VALUE, issues) +
33-
1 / expsf(STARS_VALUE, stargazers) +
34-
1 / expsf(PRS_VALUE, prs) +
35-
1 / expsf(FOLLOWERS_VALUE, followers) +
36-
1 / expsf(REPO_VALUE, totalRepos))
30+
1 / expsf(COMMITS_LAMBDA, totalCommits) +
31+
1 / expsf(CONTRIBS_LAMBDA, contributions) +
32+
1 / expsf(ISSUES_LAMBDA, issues) +
33+
1 / expsf(STARS_LAMBDA, stargazers) +
34+
1 / expsf(PRS_LAMBDA, prs) +
35+
1 / expsf(FOLLOWERS_LAMBDA, followers) +
36+
1 / expsf(REPO_LAMBDA, totalRepos))
3737

3838
let level = "";
3939

0 commit comments

Comments
 (0)