feat(gradebook): add weighted view with per-tab grade weights (pr3 of 3)#8419
Draft
LWS49 wants to merge 1 commit into
Draft
feat(gradebook): add weighted view with per-tab grade weights (pr3 of 3)#8419LWS49 wants to merge 1 commit into
LWS49 wants to merge 1 commit into
Conversation
… toggle - add GradebookWeightedTable with 3-row sticky header showing per-tab weighted subtotals and overall weighted totals per student - add ConfigureWeightsDialog for managers to edit tab weights (0–100), with sum-to-100 warning and integer/NaN validation - add All vs By-weight view toggle in GradebookIndex (role-aware) - add computeWeighted helpers for tab subtotal and student total - store weightedViewEnabled, canManageWeights, and per-tab gradebookWeight from API; wire updateWeights thunk for PATCH /gradebook/weights - add i18n keys and full test coverage for table, dialog, and helpers
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.
Summary
Adds a "By weight" view to the staff gradebook so course managers can assign per-tab grade weights and see weighted subtotals and a Total column per student. The view is gated behind a course-level setting toggled from Course Admin → Gradebook. When enabled, a toggle group appears in the gradebook toolbar; the default view (All assessments) is unchanged.
Managers can open a Configure Weights dialog to assign integer weights (0–100) per tab. Weights do not need to sum to 100 — the Total is normalised to whatever the weights sum to, and a warning is shown when the sum is off. A "Treat Ungraded as 0" toggle adjusts how missing submissions are counted, matching the Canvas-style convention. TAs see the weighted view and subtotals but not the Configure Weights button.
This is PR 3 of 3. PR 1 added the
gradebook_weightcolumn,weighted_view_enabledcourse setting, and abilities. PR 2 exposed those via the gradebook JSON and added thePATCH /gradebook/weightsendpoint.Design decisions
computeTabSubtotalandcomputeStudentTotallive incomputeWeighted.tswith no Redux dependencies, making them independently testable and reusable.dispatch(updateGradebookWeights(...))not the thunk factory directly - the thunk pattern requires dispatch; calling the factory without it silently discards the API call (caught and fixed in review).Regression prevention
Tests added:
computeWeighted.test.ts- covers null propagation (empty tab, no grades, toggle off), ratio calculation, ungraded-as-zero, weighted average, weight-0 exclusion, normalisation when weights ≠ 100ConfigureWeightsDialog.test.tsx- covers rendering, live sum, sum ≠ 100 warning, inline errors for out-of-range and non-integer values, Save dispatch, Cancel no-opGradebookWeightedTable.test.tsx- covers 3-row header structure, Total column warning, per-student subtotals, tab with no assessments (dash), Treat Ungraded as 0 recompute, all-weights-zero empty state, canManageWeights gate on Configure Weights buttonGradebookIndex.test.tsx(+3) - toggle hidden when setting off, toggle shown when on, By weight view mounts on clickBackward compatibility - the "All assessments" view and all existing gradebook behaviour are unchanged. The weighted view is only reachable when the course-level setting is explicitly enabled.
Manual testing checklist (to be run before merge):
/admin/gradebookis blocked