Skip to content

[Bugfix:TAGrading] Fix override stats counting#12651

Merged
bmcutler merged 22 commits into
Submitty:mainfrom
GarvitKhandelwal31:fix-11247-grading-stats-overrides
Jun 3, 2026
Merged

[Bugfix:TAGrading] Fix override stats counting#12651
bmcutler merged 22 commits into
Submitty:mainfrom
GarvitKhandelwal31:fix-11247-grading-stats-overrides

Conversation

@GarvitKhandelwal31

@GarvitKhandelwal31 GarvitKhandelwal31 commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Why is this Change Important & Necessary?

Closes #11247.

Grade overrides are used in two valid ways:

  • for students who already submitted
  • for students with no submission (for example makeup/external grading)

Previously, grading statistics could become confusing:

  • completion could exceed 100%
  • main grade card could appear incomplete/red due to no-submission overrides
  • override visibility in stats was unclear
  • in some cases, multiple no-submission overrides with equal marks could be undercounted in complete-stats count due to SQL deduplication behavior

This change makes completion and statistics behavior consistent and explicit.

What is the New Behavior?

  1. TA completion percentage is bounded correctly.
  • No-submission overrides no longer inflate TA completion beyond 100%.
  1. Main gradeables page button/progress reflects submitted-work completion.
  • No-submission overrides do not incorrectly force incomplete/red state.
  1. Override split line is visible in non-peer stats view.
  • Number of grade overrides: total (with submissions, without submissions)
  • This line is shown even when override filter is off.
  • When override filter is off, the UI now explicitly indicates that overrides are currently excluded from averages/counts.
  1. Completely Graded Assignments count behavior is now correct with multiple overrides.
  • Overrides for students with submissions replace those students’ base rows (no net count increase from those rows).
  • Overrides for students without submissions add new rows.
  • Query now uses UNION ALL for override rows, so multiple no-submission overrides with same marks are all counted.
  1. Manual component statistics remain component-data based.
  • Component averages/stddev/count do not change from total-score override entries (expected behavior).

What steps should a reviewer take to reproduce or test the bug or new feature?

Environment:

  1. Use sample course in local/vagrant Submitty.
  2. Use gradeable grades_released_homework (or equivalent non-team electronic gradeable).

Baseline:

  1. Open grading status page.
    Link in case of Grades Released Homework grade card-
    http://localhost:1511/courses/s26/sample/gradeable/grades_released_homework/grading/status

Before moving forward, note that in top right corner there is a button edit filers, using this only you can modify what all various types of students will be included in statistics.
2. Note:

  • Students who have submitted
  • Current percentage of TA grading done
  • Completely Graded Assignments count
image

Create override data:

  1. Open Grade Override page for the same gradeable.
  2. Add:
  • at least 1 override for a student with submission
  • at least 2 overrides for students without submission
  • assign marks 10 to students so we can clearly observe change in mean values also
    To save you time, you can add override for these students and check-
image

Verify with Include Grade Overrides ON:

  1. Open stats page, hard refresh.
  2. Confirm:
  • override split line reflects exact with/without counts
  • completion percentage remains <= 100
  • complete-stats count increases only by number of overridden students without submissions
    • Example pattern:
      • baseline = 98
      • overrides = 2 with submission + 2 without submission
      • expected complete count = 100
image

Verify with Include Grade Overrides OFF:

  1. Uncheck Include Grade Overrides and apply.
  2. Confirm:
  • override split line still visible (informational)
  • text indicates overrides are excluded from averages/counts
  • complete-stats count returns to baseline override-excluded value
image

Main page verification:

  1. Go to course gradeables page.
  2. Confirm target gradeable grading card is not incorrectly red due solely to no-submission overrides.
image Check it out here that Grades Released Homework grading card is not red.

Automated Testing & Documentation

Automated testing:

  1. Updated Cypress TAGrading stats coverage for completion guard under filter toggles.
  2. Ran override feature spec successfully.
  3. Existing unrelated instability remains in one TAGrading afterEach path (pre-existing); core behavior validated manually end-to-end for this fix.

Documentation:

  • No submitty.org update required for this bugfix.
  • Can open follow-up docs issue if maintainers want explicit override-count semantics documented.

Other information

  1. Breaking change: No
  2. Migration required: No
  3. Security concerns: None identified

@github-project-automation github-project-automation Bot moved this to Seeking Reviewer in Submitty Development Mar 25, 2026
@GarvitKhandelwal31 GarvitKhandelwal31 changed the title Fix 11247 grading stats overrides [Bugfix:TAGrading] Fix override stats counting Mar 25, 2026
@QuackHonk
QuackHonk requested review from QuackHonk March 27, 2026 20:22
@QuackHonk QuackHonk self-assigned this Mar 27, 2026
@automateprojectmangement automateprojectmangement Bot moved this from Seeking Reviewer to In Review in Submitty Development Mar 27, 2026
@QuackHonk QuackHonk removed their assignment Mar 27, 2026
@codecov

codecov Bot commented Mar 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 77 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.65%. Comparing base (a01d173) to head (959b79a).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main   #12651      +/-   ##
============================================
- Coverage     21.67%   21.65%   -0.02%     
+ Complexity     9802     9801       -1     
============================================
  Files           268      268              
  Lines         36724    36755      +31     
  Branches        490      490              
============================================
  Hits           7960     7960              
- Misses        28278    28309      +31     
  Partials        486      486              
Flag Coverage Δ
autograder 21.32% <ø> (ø)
js 2.02% <ø> (ø)
migrator 100.00% <ø> (ø)
php 20.70% <0.00%> (-0.03%) ⬇️
python_submitty_utils 80.08% <ø> (ø)
submitty_daemon_jobs 91.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@GarvitKhandelwal31

GarvitKhandelwal31 commented Mar 29, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the lint errors, the Cypress workflow failure is directly related to this issue #12683, once it gets resolved everything should pass.

@github-actions github-actions Bot added the Abandoned PR - Needs New Owner No activity on PR for more than 2 weeks -- seeking new owner to complete label Apr 13, 2026
@dagemcn

dagemcn commented Apr 14, 2026

Copy link
Copy Markdown
Member

Please resolve merge conflicts.

Copilot AI review requested due to automatic review settings April 14, 2026 21:19
@GarvitKhandelwal31
GarvitKhandelwal31 force-pushed the fix-11247-grading-stats-overrides branch 2 times, most recently from 3bf8c18 to 5fc9d6e Compare April 14, 2026 21:23
@GarvitKhandelwal31

Copy link
Copy Markdown
Contributor Author

Will do the needful soon

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes TA grading statistics and completion/progress behavior when grade overrides exist (especially for students without submissions), and makes override visibility explicit on the grading status page.

Changes:

  • Adjust TA completion/statistics queries and progress calculations so no-submission overrides don’t inflate completion beyond 100% and don’t incorrectly drive “incomplete/red” UI states.
  • Add override-count visibility (split with/without submission) to the non-peer grading status page, including an indicator when overrides are excluded by filter.
  • Update Cypress coverage for TA grading percent bounds under filter toggles, and refactor/stabilize leaderboard Cypress flows.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
site/phpstan-baseline.neon Removes now-resolved baseline entries after strict-comparison cleanup.
site/cypress/e2e/Cypress-TAGrading/grading_stats.spec.js Adds a Cypress assertion guarding TA % ≤ 100 across filter toggles.
site/cypress/e2e/Cypress-Gradeable/leaderboard_gradeable.spec.js Refactors leaderboard test helpers and adds more robust waits/timeouts.
site/app/views/grading/ElectronicGraderView.php Adds override-count params to status rendering; tightens comparisons.
site/app/views/NavigationView.php Passes grade-override filter through to TA grading progress for main page UI.
site/app/templates/grading/electronic/ta_status/StatusData.twig Displays override counts (with/without submissions) and filter-exclusion note.
site/app/models/gradeable/Gradeable.php Extends TA grading progress to respect override inclusion; strict comparison cleanup.
site/app/libraries/database/DatabaseQueries.php Updates stats SQL (UNION ALL) and adds override split-count query.
site/app/controllers/grading/ElectronicGraderController.php Wires new override-count stats to the status page and threads override filter through graded-count queries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread site/app/views/grading/ElectronicGraderView.php
Comment thread site/cypress/e2e/Cypress-TAGrading/grading_stats.spec.js Outdated
Comment thread site/app/libraries/database/DatabaseQueries.php Outdated
Comment thread site/app/models/gradeable/Gradeable.php Outdated
@GarvitKhandelwal31

Copy link
Copy Markdown
Contributor Author

Please resolve merge conflicts.

Done, also verified the functionality remains unchanged.

@GarvitKhandelwal31
GarvitKhandelwal31 marked this pull request as draft May 2, 2026 16:20
@automateprojectmangement automateprojectmangement Bot moved this from In Review to Work in Progress in Submitty Development May 2, 2026
@GarvitKhandelwal31
GarvitKhandelwal31 marked this pull request as ready for review May 3, 2026 08:54
@automateprojectmangement automateprojectmangement Bot moved this from Work in Progress to Seeking Reviewer in Submitty Development May 3, 2026
@GarvitKhandelwal31

GarvitKhandelwal31 commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

@dagemcn Resolved the merge conflicts and fix failing workflows, the remaining failures are due to connection timeout, so the PR should be good to go for review.

@dagemcn dagemcn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything here looks good but it seems that the TA grading CI is failing. It seems to be caused by this error:

Image

@github-project-automation github-project-automation Bot moved this from Seeking Reviewer to Work in Progress in Submitty Development Jun 1, 2026
@GarvitKhandelwal31

Copy link
Copy Markdown
Contributor Author

Everything here looks good but it seems that the TA grading CI is failing. It seems to be caused by this error:

Image

Yep thanks for review, fixed that.

@dagemcn dagemcn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good and functionality works as intended. Tested on Opera and I was not able to find any issues.

@github-project-automation github-project-automation Bot moved this from Work in Progress to Awaiting Maintainer Review in Submitty Development Jun 2, 2026
@github-actions github-actions Bot removed the Abandoned PR - Needs New Owner No activity on PR for more than 2 weeks -- seeking new owner to complete label Jun 3, 2026
@bmcutler
bmcutler merged commit c78aa07 into Submitty:main Jun 3, 2026
43 of 50 checks passed
@github-project-automation github-project-automation Bot moved this from Awaiting Maintainer Review to Done in Submitty Development Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Grade Override causes incorrect grading statistics

5 participants