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

[AUT-3940] Fix: Single order interaction, moving from order to data-order. #2617

Merged
merged 17 commits into from
Nov 22, 2024
Merged
2 changes: 1 addition & 1 deletion views/js/loader/qtiLoader.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/loader/taoQtiItem.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/loader/taoQtiItem.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/loader/taoQtiItemRunner.es5.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/loader/taoQtiItemRunner.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/qtiCreator/model/interactions/OrderInteraction.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ define([
};
},
afterCreate : function(){
this.attr('order', 'single')
this.attr('data-order', 'single');
this.createChoice();
this.createChoice();
this.createChoice();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ define([
], function(stateFactory, Correct, commonRenderer, instructionMgr, _, __){

var InlineChoiceInteractionStateCorrect = stateFactory.create(Correct, function(){

_createResponseWidget(this.widget);

}, function(){

_destroyResponseWidget(this.widget);

});

var _createResponseWidget = function(widget){

var interaction = widget.element,
response = interaction.getResponseDeclaration(),
correctResponse = _.values(response.getCorrect());
instructionMgr.appendInstruction(
widget.element,
interaction.attr('order') === 'single'
interaction.attr('data-order') === 'single'
? __('Please define the correct order.')
: __('Please define the correct order in the box to the right.')
);
Expand All @@ -36,16 +36,16 @@ define([
response.setCorrect(_unformatResponse(data.response));
});
};

var _destroyResponseWidget = function(widget){

widget.$container.off('responseChange.qti-widget');

commonRenderer.resetResponse(widget.element);

commonRenderer.destroy(widget.element);
};

var _formatResponse = function(response){
return {list : {identifier : response}};
};
Expand All @@ -57,6 +57,6 @@ define([
}
return res;
};

return InlineChoiceInteractionStateCorrect;
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ define([
'services/features',
'ui/liststyler'
], function (
_,
stateFactory,
Question,
formElement,
minMaxComponentFactory,
_,
stateFactory,
Question,
formElement,
minMaxComponentFactory,
formTpl,
sizeAdapter,
features
Expand All @@ -54,7 +54,7 @@ define([
var $iconRemove = this.widget.$container.find('.icon-remove-from-selection');
let minMaxComponent = null;

const order = interaction.attr('order');
const order = interaction.attr('data-order');
const isSingleOrder = order === 'single';
const minValue = interaction.attr('minChoices')
? _.parseInt(interaction.attr('minChoices'))
Expand All @@ -79,17 +79,17 @@ define([
});
});
};

const deleteMinMaxComponent = () => {
$form.find('.min-max-panel').hide();
if (minMaxComponent) {
minMaxComponent.destroy();
minMaxComponent = null;
}
};

const makeSignleOrder = () => {
interaction.attr('order', 'single');
interaction.attr('data-order', 'single');
interaction.attr('minChoices', 0);
interaction.attr('maxChoices', 0);
$interaction.addClass('qti-single');
Expand All @@ -103,7 +103,7 @@ define([
}

const makeSortOrder = () => {
interaction.attr('order', 'sort');
interaction.attr('data-order', 'sort');
$interaction.removeClass('qti-single');
createMinMaxComponent();
}
Expand Down
7 changes: 4 additions & 3 deletions views/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion views/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
},
"dependencies": {
"@oat-sa/tao-item-runner": "^1.0.0",
"@oat-sa/tao-item-runner-qti": "^2.5.1"
"@oat-sa/tao-item-runner-qti": "oat-sa/tao-item-runner-qti-fe#8a8adb608aa0dc9a21ed4b1bc4e4616c3cd35635"
Copy link
Contributor

@jsconan jsconan Nov 15, 2024

Choose a reason for hiding this comment

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

  • To be updated with the released package before merge

}
}