Skip to content

fix(scorm): six points from the review of #139 and #140 - #143

Merged
alekswebnet merged 1 commit into
mainfrom
fix/scorm-review-points
Nov 5, 2026
Merged

alekswebnet merged 1 commit into
mainfrom
fix/scorm-review-points

Conversation

@alekswebnet

Copy link
Copy Markdown
Contributor

Closes #142.

These are six small points from my review of #139 and #140, made after both merged. A zip written without options is unchanged, and the 1.2 bridge behaves as before.

What changes

The zip and the bridge (#140)

  • 2004 answers: the bridge now writes correct_responses.0.pattern and learner_response only after the interaction's type. SCORM 2004 requires that order and answers error 408 otherwise.
    • An answer whose statement names no type keeps its id, description, result, weighting, latency and timestamp, and gets neither field.
    • All ten of H5P's interaction types map in 2004, so the quiz's answers are written as before.
    • 1.2 is unchanged.
  • The results: buildScorm and buildScormInPage now return passMark and completionScore beside scormVersion. passMark is kept to the hundredth, or null. The command's summary names the mark the zip holds, so --pass-mark 66.666 prints "pass mark 66.67".
  • The design note: the no-score checks in Moodle and SCORM Cloud ran in zips that also held a mark of 80. That mark is why they recorded "passed".

The planner and the page (#139)

  • planScormInPage({ title }): a title given to the plan is now the plan's title and its writes' default, as buildScormInPage already treated it. buildScormInPage is now planScormInPage(options) followed by write().
  • One hash per plan: the build stamp is computed on the first write and kept. Before, every write read the whole package into memory and hashed it again.
  • Files added during a build: a file chosen or dropped while the page builds gets its row, is read, and waits for the next Build. Before, a drop during a build was thrown away without a word. The file input now stays enabled during a build too.

Docs:

  • design/scorm.md: the points above, and the test lists.
  • The embed README: the results' fields and the plan's title.

Testing

  • pnpm --filter @missing-elements/h5p-embed typecheck is clean.
  • The embed suite passes: 81 tests, 3 of them new and 4 extended.
    • scorm.test.ts:
      • a typed 2004 answer writes its type before the pattern and the response, and an untyped one gets neither;
      • the results carry passMark and completionScore;
      • the command run with --pass-mark 66.666 prints 66.67 and writes 0.6667.
    • scorm-browser.test.ts: a title given to the plan is its title and its writes' default, and two writes hash the package once.
    • scorm-page.test.ts: a file dropped while the quiz builds gets a row at once, and afterwards waits as "1 more to build".
  • Each new test fails without its fix.
    • With the source changes stashed and the tests kept, all four failed against the old code, each on the point it guards.
    • With only the single-hash change undone, the hash test counted 2 hashes instead of 1.

Not verified

  • No LMS was run again. The bridge change drops two writes for a 2004 answer with no type, and no H5P content type sends one.
  • The page in Firefox and Safari.

Release

This is part of embed 1.6.0, with #139 and #140. The two new result fields add API, which fits that minor release, since 1.6.0 has not shipped yet.

- The 2004 bridge writes an answer's pattern and response only after its
  type, which SCORM 2004 requires (408 otherwise).
- buildScorm and buildScormInPage return passMark and completionScore as
  written; the command's summary names the mark kept to the hundredth.
- The design note says the no-score checks ran in zips that also held a
  mark of 80.
- planScormInPage takes a title, for the plan and its writes.
- A plan hashes the package once, on its first write.
- The page takes files chosen or dropped during a build; they wait for the
  next Build.

Closes #142.
@alekswebnet
alekswebnet merged commit 401b622 into main Nov 5, 2026
8 checks passed
@alekswebnet
alekswebnet deleted the fix/scorm-review-points branch November 6, 2026 08:49
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.

SCORM zip and page: six points from the self-review of #139 and #140

1 participant