Skip to content

fix: return correct user scores for weeks with only GD#75

Merged
theanmolsharma merged 1 commit into
mainfrom
fix/user-scores-partial-week-data
Apr 9, 2026
Merged

fix: return correct user scores for weeks with only GD#75
theanmolsharma merged 1 commit into
mainfrom
fix/user-scores-partial-week-data

Conversation

@theanmolsharma
Copy link
Copy Markdown
Collaborator

Summary

  • getUserScores split queries by cohort.hasExercises and required exerciseScores in the WHERE clause, which acted as an INNER JOIN — weeks with GD but no exercise were silently dropped
  • Rewrote to fetch cohorts+weeks and user score entities (attendance, GD, exercise) as separate parallel queries, indexed by week ID for O(1) lookups
  • Each query is scoped to just the target user, avoiding unnecessary data loading

🤖 Generated with Claude Code

getUserScores used two queries split by cohort.hasExercises, with
exerciseScores in the WHERE clause acting as an INNER JOIN — weeks
that had GD but no exercise score were silently dropped from results.

Rewrite to fetch cohorts/weeks separately from user score entities,
index scores by week ID, and join in application code. This avoids
the INNER JOIN filtering and fetches only the target user's data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@theanmolsharma theanmolsharma merged commit edd4c45 into main Apr 9, 2026
2 checks passed
@theanmolsharma theanmolsharma deleted the fix/user-scores-partial-week-data branch April 9, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants