Skip to content

Feature/ppi f03 ppi widget states - #504

Open
David-Tenni wants to merge 1487 commits into
thoth-tech:developmentfrom
ontrack-features-t2-2026:feature/PPI-F03-ppi-widget-states
Open

Feature/ppi f03 ppi widget states#504
David-Tenni wants to merge 1487 commits into
thoth-tech:developmentfrom
ontrack-features-t2-2026:feature/PPI-F03-ppi-widget-states

Conversation

@David-Tenni

Copy link
Copy Markdown

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-widget component takes a Task and TaskDefinition, calls PeerProgressIndicatorService.getIndicator(), and routes the response through a pure resolvePeerProgressState() 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's unavailableMessage field 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

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • 21 unit tests total (11 on PpiWidgetComponent, 10 on resolvePeerProgressState) covering every state, loading→success and loading→error transitions, and cancellation of in-flight requests when the task changes.
  • Full local run: docker compose exec doubtfire-web npx ng test --watch=false → 21/21 of my tests pass, no regressions in other spec files.
  • Verified visually at localhost:4200 by hard-coding each mock state in the widget's load() 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(...) in ppi-widget.component.ts to one of the six mock keys.

Testing Checklist:

  • Tested in latest Chrome
  • Tested in latest Firefox

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • [X ] I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have requested a review from @macite and @jakerenzella on the Pull Request

Blocker / next-step notes

  • Local test runner needed @vitest/browser-playwright, which isn't in package.json on the base branch. I installed it locally to get tests running but deliberately left the package.json / package-lock.json changes 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 need npm install --save-dev @vitest/browser-playwright in the web container first.
  • The 4th argument to 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.

b0ink added 30 commits June 3, 2026 15:49
* 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
b0ink and others added 25 commits July 7, 2026 11:16
feat: add peer progress indicator (ppi) data contract, mock service, …

@owens-hub-git owens-hub-git left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this was intended, but It seems you made the pull request to the wrong branch, I made a resource in the OnTrack teams group which shows how and what to push to. To change this, click the edit icon next to the title and change it to 11.0.x or the team specific branch.
this icon below
Image

@officialid130-13e13 officialid130-13e13 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

6 participants