Skip to content

feat: add cross-cohort metrics endpoint - #90

Open
Vayras wants to merge 3 commits into
mainfrom
feat/cohort-metrics-endpoint
Open

feat: add cross-cohort metrics endpoint#90
Vayras wants to merge 3 commits into
mainfrom
feat/cohort-metrics-endpoint

Conversation

@Vayras

@Vayras Vayras commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds GET /cohorts/metrics (TA/Admin only), returning CohortMetricsDto[] — retention, attendance, and completion metrics for every cohort in one call.
  • avgAttendanceRate = mean over completed weeks of (attended / registered).
  • retentionRate = attendance rate of the most recently completed week (last point in the attendance trend), with retainedStudents as the underlying count.
  • completionRate = fraction of registered members who attended the cohort's GRADUATION week (0 until the cohort actually reaches it).
  • Calculation logic extracted into a pure computeCohortMetrics() helper (src/cohorts/cohort-metrics.util.ts) for reuse/readability.

Test plan

  • tsc --noEmit passes
  • eslint passes on changed files
  • Manually hit GET /cohorts/metrics as a TA/Admin user against a seeded DB and spot-check numbers against a known cohort

🤖 Generated with Claude Code

Vayras and others added 3 commits July 31, 2026 12:55
Adds GET /cohorts/metrics (TA/Admin) returning retention, attendance,
and completion metrics for every cohort in a single response.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Vayras
Vayras marked this pull request as ready for review July 31, 2026 11:44
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.

1 participant