Skip to content

BE_20 - #80

Closed
notjackl3 wants to merge 1 commit into
mainfrom
BE_20
Closed

BE_20#80
notjackl3 wants to merge 1 commit into
mainfrom
BE_20

Conversation

@notjackl3

@notjackl3 notjackl3 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Implements the GET /api/courses/[courseId]/analytics endpoint and an instructor-facing stats page for course engagement. The endpoint aggregates per-participant contributions (questions asked, answers given, upvotes received) tagged with each participant's CourseEnrollment role, plus a contiguous weekly time series of questions, answers, and active users, using Prisma groupBy and a single date_trunc aggregation query. Access is restricted to enrolled PROFESSOR/TA (401/403/404 follow the existing API error format), and the optional from/to/weekStart query params are validated with the standard ValidationResult pattern.

The stats page at /courses/[courseId]/analytics renders summary cards, a weekly engagement chart with trend lines, and a sortable role-tagged participant leaderboard, with time range filtering (today, this week, this month, last 4 weeks, or a custom range). Includes unit tests for validation and DB integration tests covering aggregation, authorization, and cross-course isolation.

Notes: Anonymous posts are counted and attributed to their real author in aggregate stats only; no per-post content is exposed by the endpoint.

Closes #75

@notjackl3 notjackl3 changed the title Be 20 BE_20 Jul 7, 2026
@jadenScali jadenScali closed this Jul 8, 2026
@jadenScali

Copy link
Copy Markdown
Collaborator

Commits are too big. Spilt into smaller single responsibility commits

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.

BE_20 - Engagement Analytics & Stats Page

2 participants