Skip to content

feat(gradebook): tab weight + excluded flag API (pr2 of 3)#8412

Draft
LWS49 wants to merge 2 commits into
lws49/feat-gradebook-weights-pr1-foundationfrom
lws49/feat-gradebook-weights-pr2-api
Draft

feat(gradebook): tab weight + excluded flag API (pr2 of 3)#8412
LWS49 wants to merge 2 commits into
lws49/feat-gradebook-weights-pr1-foundationfrom
lws49/feat-gradebook-weights-pr2-api

Conversation

@LWS49

@LWS49 LWS49 commented May 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds the backend API layer for the gradebook weighted view. Introduces a PATCH /gradebook/weights endpoint for managers to update each tab's gradebook_weight and gradebook_excluded flag in a single atomic transaction. A new gradebook_excluded boolean column on course_assessment_tabs (default false) marks tabs as "not graded", distinct from weight=0 which still participates in the normalised total. The GET /gradebook index now exposes gradebookWeight, gradebookExcluded, weightedViewEnabled, and canManageWeights so the frontend can render the weighted table without a second request.

Design decisions

  • excluded is optional in each update entry - if the key is absent the flag is not touched. This lets callers update weights only (or excluded only in future) without clearing state they didn't intend to change.
  • gradebookWeight and gradebookExcluded are only serialised per-tab when weighted_view_enabled is true, consistent with the existing conditional in the jbuilder - clients that don't use weighted view never receive these fields.
  • update_gradebook_weights validates all tab IDs belong to the course before entering the transaction, so a foreign tab ID fails fast with a 422 rather than silently skipping or partially writing.

Regression prevention

  • Tab model specs cover: bulk weight update, excluded flag set/clear, absent-key no-op, transactional rollback on invalid weight, foreign tab ID rejection.
  • Controller specs cover: 200 on valid update, excluded flag written correctly, negative/overrange weight returns 422 with no partial write, foreign tab ID returns 422, TA/student access denied, index returns gradebookWeight and gradebookExcluded when weighted view enabled and omits them when disabled.
  • Manually tested: weight update round-trip, exclude toggle persists across reload, index response shape for manager and TA.
  • Existing gradebook read paths are unchanged; update_gradebook_weights is additive and backward-compatible with callers that omit excluded.

@LWS49 LWS49 force-pushed the lws49/feat-gradebook-weights-pr2-api branch from caee9cd to e4bcfb6 Compare May 28, 2026 11:10
@LWS49 LWS49 force-pushed the lws49/feat-gradebook-weights-pr1-foundation branch from 8718f51 to f91df1d Compare May 28, 2026 11:14
@LWS49 LWS49 changed the title Lws49/feat gradebook weights pr2 api feat(gradebook): expose tab weights + weight update endpoint (pr2 of 3) May 29, 2026
@LWS49 LWS49 force-pushed the lws49/feat-gradebook-weights-pr1-foundation branch 3 times, most recently from 298ef61 to f572984 Compare May 29, 2026 09:02
@LWS49 LWS49 force-pushed the lws49/feat-gradebook-weights-pr2-api branch 5 times, most recently from 333c45a to 8b79b30 Compare June 4, 2026 06:07
LWS49 added 2 commits June 8, 2026 19:33
…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 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
@LWS49 LWS49 force-pushed the lws49/feat-gradebook-weights-pr1-foundation branch from f572984 to b7c8418 Compare June 8, 2026 11:35
@LWS49 LWS49 force-pushed the lws49/feat-gradebook-weights-pr2-api branch from 8b79b30 to 1025c75 Compare June 8, 2026 11:35
@LWS49 LWS49 changed the title feat(gradebook): expose tab weights + weight update endpoint (pr2 of 3) feat(gradebook): tab weight + excluded flag API (pr2 of 3) Jun 8, 2026
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