Skip to content

Per-course analytics page: KPI row, lesson funnel, and quiz pass rates #95

Description

@SkyDr4g0n

Parent

Spec: #91

What to build

A per-course analytics page under the course editor path, viewable by the course owner or an admin; others receive 403, and invalid or unknown course ids return 400 and 404, mirroring the students page. It is reached from the Analytics link in the overview table and from a new Analytics button in the course editor header. It is a separate route with its own loader and error boundary, not an in-page tab.

Top to bottom: a KPI row (revenue, students, completion rate, average progress, rating); the count of enrolled students who never started; the lesson funnel grouped by module, where each bar is the percentage of enrolled students (instructor excluded) with a completed progress row for that lesson, in module then lesson order, not forced monotonic, with the largest negative delta between adjacent lessons highlighted (none for courses with fewer than two lessons); and a quiz table listing each quiz in the course with pass rate and total attempts. Pass rate is distinct students whose best attempt passed over distinct students with at least one attempt.

The seed gains varied lesson progress so the funnel shows a visible drop and some never-started students.

Acceptance criteria

  • Route exists under the course editor path; owner and admin can view; others get 403; bad ids get 400 and 404.
  • Analytics link on the overview table and Analytics button in the course editor header both reach the page.
  • KPI row shows correct revenue, students, completion rate, average progress, and rating for the course.
  • Never-started count is shown above the funnel.
  • Funnel lists every lesson in module then lesson order, grouped by module, with correct percentages that can dip and recover for skipped lessons.
  • Steepest drop is highlighted; no highlight when fewer than two lessons.
  • Quiz table shows pass rate by best attempt and attempt count for every quiz in the course; quizzes with no attempts show a dash.
  • Draft courses render empty states rather than errors.
  • Funnel renders correctly in light and dark themes and at phone width; loading skeleton matches existing pages.
  • Seed includes progress data producing a visible drop and never-started students.
  • Analytics service tests cover funnel percentages with skipped lessons, steepest-drop selection including the fewer-than-two-lessons case, never-started count, instructor exclusion, and quiz pass rate with retakers and with no attempts.
  • Full test run and typecheck pass; the development database is unchanged by tests.

Blocked by

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions