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

Diagnosys: Add a finish action when you are retrying the last question. #867

Merged
merged 1 commit into from Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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