Skip to content

Commit 3170b0c

Browse files
committed
fix(loc): use LoC count for tower intensity calculation
1 parent a7f376b commit 3170b0c

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

lib/svg/layout.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ describe('computeTowers edge cases', () => {
201201
expect(testTower.contributionCount).toBe(60);
202202
// Assert h > 0 (not ghost despite 0 normal contributions)
203203
expect(testTower.h).toBeGreaterThan(0);
204+
// Assert intensityLevel is calculated correctly based on lines of code (60/60 = 100%, so intensity 4)
205+
expect(testTower.intensityLevel).toBe(4);
204206
});
205207
});
206208

lib/svg/layout.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ export function computeTowers(
127127
let intensityLevel = 0;
128128
if (hasCommits) {
129129
if (maxCommits <= 4) {
130-
intensityLevel = Math.min(4, day.contributionCount);
130+
intensityLevel = Math.min(4, count);
131131
} else {
132-
const ratio = day.contributionCount / maxCommits;
132+
const ratio = count / maxCommits;
133133
if (ratio <= 0.25) intensityLevel = 1;
134134
else if (ratio <= 0.5) intensityLevel = 2;
135135
else if (ratio <= 0.75) intensityLevel = 3;

0 commit comments

Comments
 (0)