Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent resetTask behavior across content types #159

Open
otacke opened this issue Mar 22, 2023 · 0 comments
Open

Inconsistent resetTask behavior across content types #159

otacke opened this issue Mar 22, 2023 · 0 comments

Comments

@otacke
Copy link
Contributor

otacke commented Mar 22, 2023

this.resetTask = function () {

The resetTask function is what is resetting a task to its initial state (https://h5p.org/documentation/developers/contracts#guides-header-5). This implementation does this just fine.

In contrast, when the user hits the 'Retry' button, the task will be reset plus the answer options will be shuffled (

if (params.behaviour.randomAnswers) {
// reshuffle answers
var oldIdMap = idMap;
idMap = getShuffleMap();
var answersDisplayed = $myDom.find('.h5p-answer');
// remember tips
var tip = [];
for (i = 0; i < answersDisplayed.length; i++) {
tip[i] = $(answersDisplayed[i]).find('.h5p-multichoice-tipwrap');
}
// Those two loops cannot be merged or you'll screw up your tips
for (i = 0; i < answersDisplayed.length; i++) {
// move tips and answers on display
$(answersDisplayed[i]).find('.h5p-alternative-inner').html(params.answers[i].text);
$(tip[i]).detach().appendTo($(answersDisplayed[idMap.indexOf(oldIdMap[i])]).find('.h5p-alternative-container'));
}
).

I wonder what the intended behavior of resetTask here is exactly. It is handled differently across content types. For instance, Multiple Choice and Single Choice Set keep the item order, but Drag the Words shuffles the draggables on every call to resetTask. Check with the Course Presentation demo, for instance

From the perspective of a compound content types, it could make sense to randomize a subcontent on reset (if that makes sense for the content type and if the content type is configured accordingly) in order to present the user with a fresh start instead of having the same order of items again and again. There could, however, also be cases where the exact same order is expected.

I'd just like to know what the expected behavior, so I can

  • create pull requests to content types that do not behave as expected and to
  • potentially change my own compound content types to throw away subcontent instances and create and attach new ones when resetting (even though that does not feel elegant).

@fnoks Do you happen to have any insight to share here?

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

No branches or pull requests

1 participant