Skip to content

Commit

Permalink
Diagnosys: Add a finish action when you are retrying the last question.
Browse files Browse the repository at this point in the history
Currently there is only one action: the retry, which is then
automatically executed and gives a strange flickery effect without
the student really knowing what happened.
  • Loading branch information
Jesse Hoobergs committed Nov 29, 2021
1 parent f39a99a commit 861693f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 10 additions & 3 deletions diagnostic_scripts/diagnosys.jme
@@ -1,4 +1,4 @@
state:
state (Produces the initial value of the state object): // should be renamed "initial_state"
[
"topics": map(
[
Expand All @@ -9,7 +9,7 @@ state:
values(topics)
),
"retries": 3,
"finished": false
"finished": false,
]

topics_by_objective (A dictionary mapping a learning objective name to a list of indices of topics):
Expand Down Expand Up @@ -58,6 +58,13 @@ action_retry (Use up one retry and visit the same topic again):
"next_question": random(topics[current_topic]["questions"])
]

action_stop (Stop the exam):
[
"label": "Finish the exam.",
"state": state,
"next_question": nothing
]

action_move_on (Move to the next topic, or end the exam if there are no more):
let(
state, after_answering,
Expand Down Expand Up @@ -87,7 +94,7 @@ next_actions (Actions to offer to the student when they ask to move on):
feedback, retries_feedback+"\n\n"+translate("diagnostic.next step question")
, [
"feedback": feedback,
"actions": if(not correct and state["retries"]>0, [action_retry], []) + if(can_move_on,[action_move_on],[])
"actions": if(not correct and state["retries"]>0, [action_retry], []) + if(can_move_on,[action_move_on],[action_stop])
]
)

Expand Down
4 changes: 4 additions & 0 deletions runtime/scripts/exam.js
Expand Up @@ -1196,6 +1196,10 @@ Exam.prototype = /** @lends Numbas.Exam.prototype */ {
* @param {Object} data
*/
next_diagnostic_question: function(data) {
if(data===null){
this.end()
return;
}
var topic_name = data.topic;
var question_number = data.number;
var exam = this;
Expand Down

0 comments on commit 861693f

Please sign in to comment.