Skip to content

New: Support structured feedback objects (fixes: #251)#252

Open
joe-replin wants to merge 4 commits intomasterfrom
issue/251
Open

New: Support structured feedback objects (fixes: #251)#252
joe-replin wants to merge 4 commits intomasterfrom
issue/251

Conversation

@joe-replin
Copy link
Copy Markdown
Contributor

Fixes #251
Reference: Structured Feedback Objects

Update

  • component.schema.json and properties.schema — removed legacy correct, _incorrect, _partlyCorrect properties from _feedback; replaced with the five per-state objects. _items[n].feedback type updated from string to object.
  • example.json — item feedback updated to the new object format; altText added to all items for consistency.
  • README.md — documents the new _items[n].feedback object sub-properties with a note that a plain string is still accepted; marks feedback as optional in the _items description.

New

  • Five per-state feedback objects on _feedback: _correct, _incorrectFinal, _incorrectNotFinal, _partlyCorrectFinal, _partlyCorrectNotFinal. Each accepts title, altTitle, body, _classes, _imageAlignment, and _graphic (_src, alt, attribution).
  • Top-level _feedback._classes for a CSS class applied to the feedback panel across all states.
  • _items[n].feedback now supports the full feedbackState object shape (previously only a plain string). The plain string form is still accepted.

Testing

  1. Run the v7 migration against content using the full legacy format (correct + _incorrect + _partlyCorrect) and confirm all three are converted to the new per-state objects.
  2. Run the migration against content with only _incorrect or _partlyCorrect (no correct) and confirm it is picked up and converted.
  3. Run the migration against content already using the new format and confirm it stops without modifying anything.
  4. Load the example component in the framework, submit a correct answer, and confirm correct feedback displays.
  5. Submit an incorrect answer and confirm _incorrectFinal feedback displays; with attempts remaining confirm _incorrectNotFinal falls back to _incorrectFinal when body is empty.
  6. Set _selectable: 1 and configure _items[n].feedback as an object; select the item and confirm the item-level feedback overrides the component-level state.

Introduce a structured feedback object format for MCQ items and component-level feedback. Updates README and example.json to document the new shape (per-item feedback: title, altTitle, body, _classes, _imageAlignment, _graphic; component _feedback: _correct, _incorrectFinal, _incorrectNotFinal, _partlyCorrectFinal, _partlyCorrectNotFinal, _classes, altTitle, etc.). Update properties.schema and schema/component.schema.json to change feedback from string to object and add the new fields. Add migration tests to (a) add a default _feedback.altTitle for older plugin versions and (b) convert legacy flat feedback keys (correct, _incorrect, _partlyCorrect) to the expanded per-state objects. Also fix an updatePlugin version typo in the migrations.
Copy link
Copy Markdown
Member

@oliverfoster oliverfoster left a comment

Choose a reason for hiding this comment

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

The existing readme language is quite ambiguous about the flexibility with which these two format can be used together. Please clarify.

In the readme, call flat strings "legacy" and the object format "standard", please don't make the new format sound extended or optional.

As soon as this pr is accepted, the old format effectively dies for this component.

There are no circumstances in which we will be returning to or continuing to support legacy format. We would not recommend that both formats be used in the same course.

Comment thread migrations/v7.js
Comment thread migrations/v7.js
@joe-replin
Copy link
Copy Markdown
Contributor Author

This wasn't ready for review yet but thanks for the review! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

Adopt new style of Feedback

2 participants