Skip to content

Add new players chart route#834

Merged
tudddorrr merged 1 commit intodevelopfrom
new-players-chart
Feb 17, 2026
Merged

Add new players chart route#834
tudddorrr merged 1 commit intodevelopfrom
new-players-chart

Conversation

@tudddorrr
Copy link
Collaborator

No description provided.

@tudddorrr tudddorrr added the enhancement New feature or request label Feb 16, 2026
@claude
Copy link

claude bot commented Feb 16, 2026

PR Review: Add new players chart route


Code Quality and Best Practices

🟡 Duplicated logic — calculateChange extracted but not consolidated

src/lib/math/calculateChange.ts introduces a shared calculateChange utility, but src/routes/protected/event/common.ts already has an identical inline implementation:

// event/common.ts (existing, unchanged)
function calculateChange(count: number, lastEvent: EventData | undefined): number {
  const previousCount = lastEvent?.count ?? 0
  if (previousCount === 0) return count
  return (count - previousCount) / previousCount
}

The extracted utility is never used to replace this existing duplicate. Either update event/common.ts to import from the shared utility, or leave the extraction for a separate refactor PR — but the current state leaves two diverged implementations.

🟡 fillDateGaps is also duplicated

new-players.ts has its own fillDateGaps that mirrors the one in event/common.ts with only minor structural differences (flat list vs. grouped by series name). This is the same pattern and deserves the same treatment — either reuse/generalize the existing one or acknowledge the duplication.


Potential Bugs or Issues

🔵 calculateChange return type is semantically inconsistent

When prevCount === 0, the function returns newCount (an absolute count), but otherwise returns a ratio. This means the change field carries different units depending on the data. The test at line 257 codifies this behaviour (expect(twoDaysAgoData.change).toBe(2)), but consumers of this API will need to handle the special case. If this is intentional, a comment in the utility explaining the convention would prevent future confusion.


Performance, Security, Test Coverage

No issues found.

@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.73%. Comparing base (29b0c15) to head (50de8a6).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #834      +/-   ##
===========================================
+ Coverage    95.69%   95.73%   +0.03%     
===========================================
  Files          379      382       +3     
  Lines         5919     5950      +31     
  Branches       766      770       +4     
===========================================
+ Hits          5664     5696      +32     
  Misses         149      149              
+ Partials       106      105       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tudddorrr tudddorrr force-pushed the new-players-chart branch 3 times, most recently from 84b4e5f to b8e5458 Compare February 17, 2026 08:59
@tudddorrr tudddorrr merged commit 689d97b into develop Feb 17, 2026
10 checks passed
@tudddorrr tudddorrr deleted the new-players-chart branch February 17, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant