Skip to content

Commit

Permalink
Merge pull request #2618 from oat-sa/fix/MS-2872/dissabling-external-…
Browse files Browse the repository at this point in the history
…score-if-bad-items

Fix/ms 2872/dissabling external score if bad items
  • Loading branch information
tikhanovichA authored Nov 12, 2024
2 parents 98a8992 + 7f2716b commit b6303df
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
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.

18 changes: 11 additions & 7 deletions views/js/qtiCreator/plugins/panel/outcomeEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ define([
* @param {Object} item
* @param {JQuery} $outcomeEditorPanel
*/
function renderListing(item, $outcomeEditorPanel, isNewItem = false) {
function renderListing(item, $outcomeEditorPanel) {
const readOnlyRpVariables = getRpUsedVariables(item);
const scoreMaxScoreVisible = features.isVisible('taoQtiItem/creator/interaction/response/outcomeDeclarations/scoreMaxScore');
const scoreExternalScored = _.get(_.find(item.outcomes, function (outcome) {
return outcome.attributes && outcome.attributes.identifier === 'SCORE';
}), 'attributes.externalScored', externalScoredOptions.none);

const outcomesData = _.map(item.outcomes, function (outcome) {
let outcomesData = _.map(item.outcomes, function (outcome) {
const readonly = readOnlyRpVariables.indexOf(outcome.id()) >= 0;
const id = outcome.id();
let externalScoredDisabled = outcome.attr('externalScoredDisabled');
Expand All @@ -113,9 +113,6 @@ define([
}
};
function setExternalScoredToNone() {
externalScored.none.selected = true;
externalScored.human.selected = false;
externalScored.externalMachine.selected = false;
externalScoredDisabled = 1;
outcome.removeAttr('externalScored');
}
Expand Down Expand Up @@ -154,10 +151,17 @@ define([
: __('Delete'),
titleEdit: readonly ? __('Cannot edit a variable currently used in response processing') : __('Edit'),
readonly: readonly,
externalScoredDisabled: isNewItem ? (externalScoredDisabled || 0) : 0
externalScoredDisabled: externalScoredDisabled || 0
};
});

const allExternalScoredDisabled = outcomesData.every(outcomeData => outcomeData.externalScoredDisabled === 1);

if (allExternalScoredDisabled) {
// Update all externalScoredDisabled values to false if we have inconsistente data from bad items
outcomesData.forEach(outcomeData => outcomeData.externalScoredDisabled = 0);
}

$outcomeEditorPanel.find('.outcomes').html(
listingTpl({
outcomes: outcomesData
Expand Down Expand Up @@ -493,7 +497,7 @@ define([
newOutcome.buildIdentifier('OUTCOME');

//refresh the list
renderListing(item, $outcomeEditorPanel, true);
renderListing(item, $outcomeEditorPanel);
});

//attach to response form side panel
Expand Down

0 comments on commit b6303df

Please sign in to comment.