Skip to content

SCORM helpers

The per-standard knowledge, kept out of the runtimes so it can be tested without an LMS. ScormVocabularyTests and ScormSuspendPolicyTests cover most of this folder directly.

File Job
ScormStatusMap Translates statuses and interaction vocabulary between the two standards
ScormTime Formats and parses SCORM durations
ScormErrors Decodes LMS error numbers into sentences, and hosts DescribeLastError()
ScormSessionGuard Tracks whether a session is live, so late writes are refused locally
SuspendDataUtil Packs, compresses and size-checks suspend data
RevLearningSuspendEnvelope The versioned wrapper typed suspend data is stored in
LmsObjectives / LmsInteractions Index bookkeeping for the two indexed collections

ScormTime

Two formats, and they are not interchangeable. SCORM 1.2 wants HHHH:MM:SS.SS; SCORM 2004 wants an ISO 8601 duration, PT1H30M5S. Both are generated here and both are parsed back, because session time accumulates across a resumed attempt and the previous value has to be read to add to it.

SuspendDataUtil

ToSafeJson serializes, compresses if that helps, and checks the result against the standard's limit — 4096 characters on 1.2, 64000 on 2004.

If it still will not fit, it returns null and logs an error. It does not truncate. A truncated JSON payload cannot be deserialized, so storing one destroys the last save that could be, and the learner loses their progress on resume rather than at the moment of the oversized save. Refusing is visible; truncating is silent and worse. IsCompressed and SizeOf are there so a course can check before it commits to a save format.

ScormStatusMap

InteractionResult(result, version) is the one to know: it normalizes wrong and incorrect to whichever spelling the target standard accepts, so a course can use either. The status mapping is the same idea applied to lesson_status versus the 2004 completion and success pair.