Skip to content

Scope student progress to the current course links. - #318

Open
csev wants to merge 1 commit into
masterfrom
slow-query-student-progress
Open

csev wants to merge 1 commit into
masterfrom
slow-query-student-progress

Conversation

@csev

@csev csev commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • The instructor student-progress page joined lti_result on user id, so each enrolled student pulled every result on the site. On py4e that query reached 102 seconds.
  • Aggregate completion and last activity from the links in this course, and start the discussion counts from those links too. STRAIGHT_JOIN keeps MySQL on the link index.
  • Last activity is the newest result in this course, or the membership timestamp when the student has none here. Completion is still a distinct lesson link at 80% or higher.

Test plan

  • As an instructor, open /grades/student-progress and confirm the roster, completion percentages, and discussion counts.
  • Search by name or email, and sort by last activity and progress.
  • Confirm a student with no grades in this course still appears, with last activity taken from the membership row.

Summary by CodeRabbit

  • Refactor
    • Updated the calculation of student progress, assignment completion, and discussion activity. Existing progress percentages, completion thresholds, and discussion counts remain unchanged. No new user-facing features or changes to displayed results are included.

The roster query joined every result for each student, so a course page scanned the whole result table.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between ce3351e and 7e2b92a.

Files selected for processing: 1
  • lib/src/Controllers/Grades.php

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

Walkthrough

Grades::studentProgress now calculates discussion counts from course links and uses a per-student aggregate for assignment activity and progress values.

Changes: Student progress query

Layer / File(s) Summary
Discussion count subqueries
lib/src/Controllers/Grades.php
Both discussion-count subqueries start from course links and use STRAIGHT_JOIN for thread and comment lookups.
Assignment activity aggregation
lib/src/Controllers/Grades.php
A per-student subquery aggregates latest result times and completed assignments. The outer query uses those values for progress and filters out deleted memberships.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Merge Risk: Minimal · up to 7e2b9

No actionable merge-blocking issue was established. The roster query appears ready to merge after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: limiting student-progress calculations to links in the current course.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ast-grep (0.50.0)
lib/src/Controllers/Grades.php

ast-grep output exceeded the maximum buffer for this file

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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