Feature/ppi f03 ppi widget states - #504
Conversation
* refactor: format codebase and implement lint checks * ci: fail lint workflow on warnings * chore: remove rule ignore * refactor: remove empty lifecycle methods * chore: revert empty method * refactor: switch to modern lifecycle methods * refactor: switch to records * refactor: consistent type assertions * refactor: consistent type definitions * refactor: remove empty block statements * chore: re-enable no useless escape rule * chore: reenable no misleading character class rule * chore: no wrapper object types * chore: fix no constant binary expression * refactor: remove this alias * refactor: no unused expressions * refactor: prefer const * chore: no var rule * refactor: no unused vars * refactor: no inline templates * refactor: no inline styles * refactor: enforce modern angular control flow * refactor: no empty functions * chore: update pull request template * refactor: consistent generic constructors * refactor: no empty object types * chore: remove todo * refactor: remove use of any * refactor: enforce alt text * chore: enforce no empty content * chore: add todo * chore: add recommended rules * refactor: sort tailwind classes
* chore: init communication system editor * feat: add core communications logic * refactor: improve ui layout * refactor: preview email * refactor: ability to edit conditions and actions * refactor: clean up ui layout * feat: enable set execution * refactor: improve layout * refactor: improve ui layout * feat: add confirmation modals to execute rule and set * feat: add scheduling ui * chore: remove duplicate header * fix: ensure students are loaded * refactor: move buttons * fix: disable horizontal scrolling * refactor: improve ui * chore: revert full width change * chore: improve current week ui * chore: format * feat: add spec con days condition * feat: add task comment action * chore: fix layout * chore: remove unnecessary shortcuts * refactor: use server side current week number * refactor: modularise components * chore: fix styling
fix: persist portfolio filters in url
feat: task list filters and sorting
feat: rediscuss status
…tes to PPI widget
feat: add peer progress indicator (ppi) data contract, mock service, …
officialid130-13e13
left a comment
There was a problem hiding this comment.
I manually tested all six PPI indicator states by switching the mock state and confirmed the correct UI output for each:
zero — No peers have submitted this task yet.
normal — 42% of peers at your target grade have submitted.
suppressed — Not enough students to show progress.
unavailable — Progress unavailable.
stale — 55% of peers at your target grade have submitted (may be outdated).
disabled — Peer Progress Indicator is disabled for this unit.
I also ran the full test suite for the PPI feature:
peer-progress-indicator-state.spec.ts (10 tests)
ppi-widget.component.spec.ts (11 tests)
All 21 tests passed, including state resolution, stale‑data handling, suppressed cohort behaviour, disabled feature behaviour, and request cancellation logic.
I believe you need to rebase your PR to the base branch: feature/peer-progress-indicator instead of thoth-tech:development. Rest everything looks correct from my end.
Description
Adds safe loading, hidden, unavailable, disabled, stale and error states to the peer progress indicator widget that renders inside the task description card. Built on top of Gurwinder's PPI data contract PR (#5,
feature/ppi-data-contract) — this PR is what consumes that data contract for the first time in the UI.The new
f-ppi-widgetcomponent takes aTaskandTaskDefinition, callsPeerProgressIndicatorService.getIndicator(), and routes the response through a pureresolvePeerProgressState()function into one of the eight UI states (loading / success / no-data / hidden / unavailable / disabled / stale / error). Plain-language messages for the "safe" states come from the API'sunavailableMessagefield so the widget never leaks why another student's data is hidden. Stale peer values never appear after an error, new request, or task switch — the state resolver only reads response data when the request is not loading and has no error, and the widget cancels in-flight requests before starting new ones.Fixes PPI-F03.
Type of change
How Has This Been Tested?
PpiWidgetComponent, 10 onresolvePeerProgressState) covering every state, loading→success and loading→error transitions, and cancellation of in-flight requests when the task changes.docker compose exec doubtfire-web npx ng test --watch=false→ 21/21 of my tests pass, no regressions in other spec files.localhost:4200by hard-coding each mock state in the widget'sload()method ('normal'/'zero'/'suppressed'/'unavailable'/'stale'/'disabled') and screenshotting each — see below.To reproduce locally: log in as
student_1/password, open any task in COS10001, and observe the widget beneath the task description. To preview each state, change the 4th argument of.getIndicator(...)inppi-widget.component.tsto one of the six mock keys.Testing Checklist:
Checklist:
Blocker / next-step notes
@vitest/browser-playwright, which isn't inpackage.jsonon the base branch. I installed it locally to get tests running but deliberately left thepackage.json/package-lock.jsonchanges out of this PR since it's a dev-env issue and not part of PPI-F03. Flagging separately to Maple. Reviewers running tests locally will neednpm install --save-dev @vitest/browser-playwrightin the web container first.PeerProgressIndicatorService.getIndicator()is hardcoded to'normal'— this is how PR migrate: bootstrap rating #5's mock service picks which state to return. This argument goes away entirely once a real backend replaces the mock.