Skip to content

Comments

✨ Build v4 learning-area quiz foundation#2370

Open
b-l-i-n-d wants to merge 80 commits into4.0.0-devfrom
v4-quiz
Open

✨ Build v4 learning-area quiz foundation#2370
b-l-i-n-d wants to merge 80 commits into4.0.0-devfrom
v4-quiz

Conversation

@b-l-i-n-d
Copy link
Collaborator

@b-l-i-n-d b-l-i-n-d commented Feb 18, 2026

Issue

The v4 quiz flow had two maintainability and behavior risks:

  • Question field naming logic was distributed across templates with repeated string construction.
  • Quiz auto-start could trigger duplicate start requests in v4, causing multiple start attempts under some conditions.

User impact

  • Distributed field naming made template updates error-prone and increased the chance of inconsistent payload structures across question types.
  • Duplicate auto-start requests could create more than one quiz attempt and produce confusing behavior for learners.

Root cause

  • Field-name construction was not centered around a single canonical base.
  • In the v4 quiz action form, auto-start initialization was redundantly invoked by both Alpine component lifecycle and explicit template init wiring.

Fix

1) Centralized field-name composition model

  • Introduced a shared base field name in the question wrapper and passed it into question templates.
  • Templates now compose their own suffixes ([], [answers][], [answer_id][id], etc.) from that base.
  • This keeps one source of truth for the prefix while preserving per-template clarity for shape-specific keys.

2) Prevent duplicate auto-start requests (v4)

  • Removed redundant x-init="init()" from the v4 quiz auto-start form.
  • The component init() lifecycle now runs once as intended, preventing duplicate start mutations.

Validation

  • PHP lint checks run on all modified quiz wrapper/question template files and classes/Quiz.php.
  • All checked files reported no syntax errors.

Commits in this PR update

  • refactor(quiz): centralize question defaults and validation context
  • refactor(quiz): compose field names from shared base
  • fix(quiz): prevent duplicate auto-start requests in v4

…d update TypeScript module resolution settings.
…r template and improved image attachment handling.
…us and improve form input handling for multiple-choice and true-false questions.
… question types and introduce new input component for open-ended questions.
…ntax and update form component dynamic name access.
…ring questions and integrate enhanced quiz form submission.
…iz ordering and matching questions, adding clear drop zone functionality.
…oving redundant helper methods and refining order retrieval.
…nt object instead of direct element argument.
@b-l-i-n-d b-l-i-n-d added the 4.0.0 Tutor v4.w0w label Feb 18, 2026
@b-l-i-n-d b-l-i-n-d changed the title ✨ Build v4 learning-area quiz foundation ♻️ Consolidate quiz question defaults and validation context Feb 20, 2026
@b-l-i-n-d b-l-i-n-d changed the title ♻️ Consolidate quiz question defaults and validation context ✨ Build v4 learning-area quiz foundation Feb 20, 2026
@b-l-i-n-d b-l-i-n-d changed the title ✨ Build v4 learning-area quiz foundation ♻️ Consolidate quiz question context and field name composition Feb 20, 2026
@b-l-i-n-d b-l-i-n-d changed the title ♻️ Consolidate quiz question context and field name composition ✨ Build v4 learning-area quiz foundation Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0.0 Tutor v4.w0w

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants