Conversation
Collaborator
|
Commits are too big. Spilt into smaller single responsibility commits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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