feat(gradebook): expose tab weights + weight update endpoint (pr2 of 3)#8412
Draft
LWS49 wants to merge 3 commits into
Draft
feat(gradebook): expose tab weights + weight update endpoint (pr2 of 3)#8412LWS49 wants to merge 3 commits into
LWS49 wants to merge 3 commits into
Conversation
…alog, toolbar buttons, visibility state, and tests
- Add MuiColumnPickerDialog with Apply/Export actions, locked-column enforcement, and optional dataColumnIds hint when no data columns are selected
- Update MuiTableToolbar to render a trigger button (opens dialog) and a direct export button alongside the existing CSV download icon
- Extend useTanStackTableBuilder with column visibility state (localStorage persistence, dynamic reconciliation), onExportFromPicker, onDirectExport, and cross-page selection helpers (selectedCount, toggleAllFiltered, etc.)
- Add ColumnPickerTemplate interface and Body.ts selection fields
- Add full test coverage for dialog, toolbar, and hook behaviour
- Add lib.components.table.* locale keys (en/ko/zh)
- Add gradebook_weight (0-100 integer) column to course_assessment_tabs - Add Course::Settings::GradebookComponent with weighted_view_enabled - Add manage_gradebook_weights/settings abilities (manager/owner only) - Add Course Admin -> Gradebook settings page to toggle the setting
- add Tab.update_gradebook_weights: transactional bulk update scoped to course tabs, with pre-flight ID validation and single pre-fetch query - extend GET /gradebook index JSON with weightedViewEnabled, canManageWeights, and per-tab gradebookWeight (gated by setting) - add PATCH /gradebook/weights: manager-only, returns 422 on validation failure or foreign tab, transactionally rolls back on any error
caee9cd to
e4bcfb6
Compare
8718f51 to
f91df1d
Compare
298ef61 to
f572984
Compare
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 the backend API layer for the Gradebook weighted view feature. This PR introduces the
GradebookComponent, ability definitions, routes, and two controllers: one for reading and updating the weighted view setting via the admin settings panel, and one serving the full Gradebook index payload (students, assessments, tabs, submissions, max grades) plus aupdate_weightsendpoint for persisting per-tab gradebook weights. The weighted view toggle is gated to managers/owners, andgradebookWeightis conditionally included in the tabs payload only when the weighted view is enabled.Design decisions
gradebookWeightis omitted from the tabs JSON whenweighted_view_enabledis false - reduces payload size and avoids exposing weight data to clients that won't use it.update_gradebook_weightsruns in a transaction and raisesRecordNotFoundfor tabs outside the course before touching the DB - prevents partial updates and cross-course weight mutation in one pass.grade_summaryandmax_gradesuse raw SQL withfind_by_sql+sanitize_sql_arrayrather than AR scopes - the multi-join aggregations don't map cleanly to AR's query interface and the raw form is easier to read and audit.manage_gradebook_weightsandmanage_gradebook_settingsare separate abilities - weight management is for managers/owners, settings management follows the same boundary, keeping them independently restrictable if requirements change.Regression prevention
Covers: gradebook controller index payload shape,
update_weightshappy path and error cases (invalid tab, out-of-range weight), ability checks for staff/manager/owner/student, settings controller read/update,Tab#update_gradebook_weightsvalidation and cross-course guard,Assessment.max_grades,Submission.grade_summary, GradebookSettings frontend form render and PATCH on submit.Manual testing confirmed: settings page renders and saves; index payload includes
canManageWeightsandgradebookWeightcorrectly;update_weightspersists valid weights and rejects out-of-range and foreign tab IDs; student access returns 403; weighted view disabled omitsgradebookWeightfrom response.Existing admin settings pattern (
Course::Admin::Controller+@settings+ jbuilder) is followed without modification - no behaviour change for other settings pages.