Skip to content

fix: give the question bank a door and show Add before a process is picked - #626

Open
phamtruonghung wants to merge 4 commits into
mainfrom
wt/t_6e5fa9e3
Open

phamtruonghung wants to merge 4 commits into
mainfrom
wt/t_6e5fa9e3

Conversation

@phamtruonghung

Copy link
Copy Markdown
Owner

The Question bank (/assessments/questions) had no way in: Routes.assessmentQuestions had no call site, and the bank hid Add and Paste until a process was chosen, so a first visit offered no "Thêm câu hỏi".

  • Register header (assessments_screen.dart): a new Question bank outlined button (questionBankKey, Icons.library_books_outlined) sits between Refresh and the Marking queue. It shows to every caller who can open the register, because the bank is readable plant-wide (ADR-0009) and renders read-only without PPL_ASSESSMENT_CHANGE.
  • Bank header (assessment_questions_screen.dart): Add and Paste now depend only on mayChange. They stay disabled, with the tooltip "Chọn một công đoạn" (assessmentChooseProcessTitle), until a process is chosen. A reader still sees neither button.

There is no new Destination, ARB key or golden, and no backend change.

Tests: assessment_register_test.dart has "Question bank opens the bank for a caller who may only read assessments". It covers a caller with display only, and asserts the router location is Routes.assessmentQuestions. assessment_bank_test.dart has three tests: buttons present but disabled before a process is chosen, enabled after, and absent for a reader. The existing "register, not the bank" test now checks by Screen type, because the register header now carries the "Question bank" text.

Closes #625

phamtruonghung and others added 4 commits November 26, 2026 22:09
…icked

The Assessments register header gains an unconditional Question bank button, since the bank is readable plant-wide (ADR-0009) and until now its Screen had no way in. In the bank, Add and Paste now show for any caller holding PPL_ASSESSMENT_CHANGE and stay disabled, with a "choose a process" tooltip, until a process is chosen, rather than being hidden entirely.

Closes #625

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The register's header now carries four actions (Refresh, Question bank,
Marking queue, New assessment), and at a 900px window they no longer fit
beside the title: the header only fell back to its wrapped layout below the
560px breakpoint, so the one-row layout overflowed by 36px and the palette
sweep caught a header action outside the surface.

AppPageHeader now also takes its existing wrapped layout when the actions'
natural width would leave the title less than 200px of the row. The
breakpoint rule is unchanged, and a header whose actions fit lays out
exactly as before, so no golden moves. The decision is made during layout
by a small single-child render object, the way LayoutBuilder works, and the
child it built last time is updated in place so the actions keep their
State and focus across rebuilds.

Refs #625

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ster at 1200/900/600

The header test uses a single 400px action. The box is exactly
action + Spacing.md + AppPageHeader.minTitleWidth wide, so it is above
the 560 breakpoint. At that width the action stays on the title row;
one pixel narrower it wraps under the title. The lib compares with a
strict `>`, and the test pins that boundary. The register test renders
the full four-action header (a caller holding CHANGE and MARK) at
window widths 1200, 900 and 600. At each width it asserts no overflow,
that all four actions are present, and that Question bank is
hit-testable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

The Question bank has no door: nothing links to /assessments/questions, and Add is hidden until a process is picked

1 participant