Skip to content

fix(quiz): question images, mtf connectors, response column and passPercentage - #704

Merged
likhithThammegowda merged 5 commits into
masterfrom
fix/quiz-question-image-and-mtf-lines
Aug 3, 2026
Merged

fix(quiz): question images, mtf connectors, response column and passPercentage#704
likhithThammegowda merged 5 commits into
masterfrom
fix/quiz-question-image-and-mtf-lines

Conversation

@likhithThammegowda

Copy link
Copy Markdown
Contributor

Repairs three visible defects in the quiz player, plus two smaller correctness issues and one i18n gap. Release notes for 4.2.9 ride along on this branch.

Fixes

  • Question images never rendered. The image path resolver stripped the src=" prefix with a replace that only matched paths beginning with /, so an absolute src="https://…" became src=https://… and Angular's sanitizer rewrote it to unsafe:src=https://…. 11 of the 17 questions in the sampled quiz use absolute URLs. Absolute and data: URLs are now left as authored; relative paths still resolve against the artifact URL.
  • Match-the-following connectors drifted on scroll. jsPlumb was instantiated without a Container, so it appended its SVG connectors to document.body in page coordinates while the boxes sat inside the scrolling dialog. Both now share a container and move together.
  • The Response column of the mtf review table was always empty. Two defects: the guard indexed the connection list by option position, blanking rows past the number of connections; and it compared rendered innerText against raw option text, which never matched because CSS collapses the double spaces and   in the authored content.
  • passPercentage: 0 was taken literally, so every attempt counted as a pass. Zero is now treated as unset and falls back to 60%.
  • The quiz overview dialog could not be reopened, leaving "Yes, Restart" doing nothing. The ref was only cleared by a commented-out line.
  • The ASHA competency card showed untranslated text to Hindi users. It asked for COMPETENCY, which exists in en.json but not hi.json.

Verification

  • Production build green (yarn run build:local, exit 0).
  • The image and Response fixes were verified by replaying the old and new logic against the real quiz artifact do_1146265771989319681410.

Risk

All five code fixes live under project/ws/viewer and project/ws/app, which jest.config.js excludes via testPathIgnorePatterns — so they carry no unit test coverage and the build is the only automated gate.

The connector-drift and restart fixes are reasoned from the DOM and dialog lifecycle but were not confirmed in a browser. Smoke-testing is marked required in the release notes: open a quiz with image questions, answer a match-the-following question while scrolling, check the Response column after submit, and confirm "Yes, Restart" reopens the overview.

…sponse column

Three defects in the quiz viewer, all verified against the live quiz artifact for
do_1146265771989319681410.

Question images never loaded. The image path resolver stripped the `src="` prefix
with `.replace('src="/', '')`, which only matches paths starting with `/`. An
absolute `src="https://…"` therefore kept its prefix and became `src=https://…`,
which Angular's sanitizer rewrote to `unsafe:src=https://…`. 11 of the 17
questions in that quiz carry absolute image URLs. Absolute and data: URLs are now
left as authored; relative paths still resolve against the artifact URL.

Match-the-following connectors drifted away from their boxes on scroll. jsPlumb
was created without a Container, so it appended its SVGs to document.body and
positioned them in page coordinates while the boxes lived inside the scrolling
dialog. The connectors now share a container with the boxes, so both move
together — no repaint needed.

The Response column of the mtf review table was always empty:
- the guard tested `connections[i]`, indexing the connection list by option
  position, so rows past the number of connections were blanked even when
  answered
- it compared `source.innerText` against `option.text` directly. innerText is the
  *rendered* text and CSS collapses whitespace runs; authored option text
  frequently contains double spaces and  , so the two never matched. 5 of 6
  options in question 10 are affected

Note: project/ and library/ are excluded from jest via testPathIgnorePatterns, so
these paths carry no unit coverage. Verified by simulating the old and new logic
against the real artifact JSON instead.
A quiz publishing with passPercentage 0 was taken at face value, so every
attempt counted as a pass. Only a missing property fell back to the 60% default.
Zero is now treated the same as absent, in both the TOC assessment detail and the
viewer's quiz route.
The overview ref was only cleared by a commented-out line at the end of the
afterClosed handler, so the `!this.dialogOverview` guard turned every later call
into a no-op for the life of the component and "Yes, Restart" never reopened the
overview. Clear it as soon as the dialog closes.
…a card

The asha learning card asked for `COMPETENCY`, which is present in en.json but
missing from hi.json, so Hindi users saw the raw key. Point it at `Competency`
and `Completed`, both of which exist in each locale, and add the missing `LEVELS`
entry to hi.json.
@likhithThammegowda
likhithThammegowda merged commit a771c5f into master Aug 3, 2026
1 check failed
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.

3 participants