Skip to content

Commit

Permalink
use numbas.review_allowed from SCORM to decide whether to enter rev…
Browse files Browse the repository at this point in the history
…iew mode on resuming a finished attempt
  • Loading branch information
christianp committed Sep 27, 2024
1 parent 1ec6d12 commit bcca1d1
Show file tree
Hide file tree
Showing 8 changed files with 247 additions and 125 deletions.
4 changes: 2 additions & 2 deletions runtime/scripts/exam.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ Exam.prototype = /** @lends Numbas.Exam.prototype */ {
'allowrevealanswer',
'advicethreshold',
],
exam,
settings,
[
'showActualMark',
'showTotalMark',
Expand Down Expand Up @@ -1346,7 +1346,7 @@ Exam.prototype = /** @lends Numbas.Exam.prototype */ {

//display the results

var revealAnswers = this.settings.enterReviewModeImmediately || this.entry == 'review' || Numbas.is_instructor;
var revealAnswers = this.settings.enterReviewModeImmediately || (this.entry == 'review' && this.store.reviewModeAllowed()) || Numbas.is_instructor;

for(var i=0;i<this.questionList.length;i++) {
this.questionList[i].lock();
Expand Down
9 changes: 9 additions & 0 deletions runtime/scripts/scorm-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,15 @@ SCORMStorage.prototype = /** @lends Numbas.storage.SCORMStorage.prototype */ {
return this.get('mode');
},

/** Is review mode allowed?
*
* @returns {boolean}
*/
reviewModeAllowed: function() {
var allowed = pipwerks.SCORM.get('numbas.review_allowed');
return allowed !== 'false';
},

/** Call this when the student moves to a different question.
*
* @param {Numbas.Question} question
Expand Down
5 changes: 5 additions & 0 deletions runtime/scripts/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ Numbas.storage.BlankStorage.prototype = /** @lends Numbas.storage.BlankStorage.p
* @returns {string}
*/
getMode: function() {},
/** Is review mode allowed?
*
* @returns {boolean}
*/
reviewModeAllowed: function() {},
/** Call this when the student moves to a different question.
*
* @abstract
Expand Down
19 changes: 11 additions & 8 deletions tests/locales.js
Original file line number Diff line number Diff line change
Expand Up @@ -1545,10 +1545,8 @@ Numbas.locale = {
"control.submit part.confirm remove next parts": "<p>One or more subsequent parts depend on your answer to this part. Submitting this part again will invalidate those parts, and remove them from the question. This cannot be undone.</p>\n<p>Would you like to submit this part again?</p>",
"control.proceed anyway": "Proceed anyway?",
"control.regen": "Try another question like this one",
"control.submit answer": "Submit answer",
"control.submit all parts": "Submit all parts",
"control.submit again": "Submit again",
"control.submit": "Submit",
"control.submit answer": "Save answer",
"control.submit all parts": "Save all answers",
"control.previous": "Previous",
"control.next": "Next",
"control.advice": "Advice",
Expand Down Expand Up @@ -1718,7 +1716,7 @@ Numbas.locale = {
"part.marking.maximum scaled down": "The maximum you can score for this part is <strong>{{count,niceNumber}}</strong> $t(mark). Your scores will be scaled down accordingly.",
"part.marking.used variable replacements": "This part was marked using your answers to previous parts.",
"part.marking.variable replacement part not answered": "You must answer {{part}} first.",
"part.marking.resubmit because of variable replacement": "This part's marking depends on your answers to other parts, which you have changed. Submit this part again to update your score.",
"part.marking.resubmit because of variable replacement": "This part's marking depends on your answers to other parts, which you have changed. Save your answer to this part again to update your score.",
"part.marking.not submitted": "No answer submitted.",
"part.marking.did not answer": "You did not answer this question.",
"part.marking.total score": "You scored <strong>{{count,niceNumber}}</strong> $t(mark) for this part.",
Expand Down Expand Up @@ -1750,8 +1748,11 @@ Numbas.locale = {
"part.missing type attribute": "{{part}}: Missing part type attribute",
"part.unknown type": "{{part}}: Unrecognised part type {{type}}",
"part.setting not present": "Property '{{property}}' not set",
"part.feedback out of date": "This feedback is based on your last submitted answer. Submit your changed answer to get updated feedback.",
"part.feedback out of date": "This feedback is based on your last submitted answer. Save your changed answer to get updated feedback.",
"part.input title": "Answer for part {{name}}",
"part.show feedback": "Show feedback",
"part.hide feedback": "Hide feedback",
"part.feedback title": "Feedback for {{name}}.",
"part.correct answer title": "Expected answer for part {{name}}",
"part.waiting for pre submit": "Your answer is being marked. Please wait.",
"part.jme.answer missing": "Correct answer is missing",
Expand All @@ -1778,6 +1779,7 @@ Numbas.locale = {
"part.numberentry.answer invalid": "You did not enter a valid number.",
"part.numberentry.answer not reduced": "Your answer is not reduced to lowest terms.",
"part.numberentry.give your answer as a reduced fraction": "Reduce your answer to lowest terms.",
"part.numberentry.write your answer as a fraction": "Write your answer as a fraction.",
"part.numberentry.answer not integer": "Your answer is invalid. You must enter a whole number, not a decimal.",
"part.numberentry.answer not integer or decimal": "Your answer is invalid. You must enter an integer or a decimal.",
"part.numberentry.answer not integer or decimal or fraction": "Your answer is invalid. You must enter an integer, a decimal or a fraction.",
Expand Down Expand Up @@ -1837,6 +1839,7 @@ Numbas.locale = {
"question.header": "Question {{number}}",
"question.submit part": "Save answer",
"question.answer saved": "Answer saved",
"question.all answers saved": "All answers saved",
"question.show steps": "Show steps",
"question.show steps penalty": "You will lose <strong>{{count,niceNumber}}</strong> $t(mark).",
"question.show steps no penalty": "Your score will not be affected.",
Expand All @@ -1849,8 +1852,8 @@ Numbas.locale = {
"question.no such part": "Can't find part {{path}}.",
"question.can not submit": "Can not submit answer - check for errors.",
"question.answer submitted": "Answer submitted",
"question.unsubmitted changes": "You have made a change to your answer but not submitted it. Please check your answer and then press the <strong>Submit answer</strong> button.",
"question.unsubmitted changes_plural": "You have made changes to your answers but not submitted them. Please check your answers to each part and then press the <strong>Submit all parts</strong> button.",
"question.unsubmitted changes": "You have made a change to your answer but not submitted it. Please check your answer and then press the <strong>Save answer</strong> button.",
"question.unsubmitted changes_plural": "You have made changes to your answers but not submitted them. Please check your answers to each part and then press the <strong>Save all answers</strong> button.",
"question.score feedback.show": "Show feedback",
"question.score feedback.hide": "Hide feedback",
"question.score feedback.not marked": "Not marked",
Expand Down
Loading

0 comments on commit bcca1d1

Please sign in to comment.