Default exam files
For an exam we can specify a couple of different default files to specify global defaults for exams.
Navigation
Our three exams use exactly the same navigation. We can therefore move the navigation field to a default file.
The navigation field of an exam can be specified in a file named navigation.yaml
in the defaults
folder.
---
mode: sequential
start_password: none
can_regenerate: true
show_steps: false
show_title_page: false
confirm_when_leaving: false
show_names_of_question_groups: true
allow_printing: false
can_move_to_previous: true
browsing_enabled: true
show_results_page: never
on_leave:
action: none
Try compiling the exams again. You should see that the compilation works and that the navigation is still the same within the exams.
Feedback
Our three exams use exactly the same feedback. We can therefore move the feedback field to a default file.
The feedback field of an exam can be specified in a file named feedback.yaml
in the defaults
folder.
---
percentage_needed_to_pass: 50
show_name_of_student: false
show_current_marks: true
show_maximum_marks: true
show_answer_state: true
allow_reveal_answer: true
review:
show_score: true
show_feedback: true
show_expected_answer: true
show_advice: true
advice: "Please practice more"
intro: "An introductory text"
feedback_messages: []
Try compiling the exams again. You should see that the compilation works and that the feedback is still the same within the exams.
Timing
Our three exams use exactly the same timing. We can therefore move the timing field to a default file.
The timing field of an exam can be specified in a file named timing.yaml
in the defaults
folder.
---
duration_in_seconds: none # no time limit
allow_pause: true
on_timeout:
action: none
timed_warning:
action: none
Try compiling the exams again. You should see that the compilation works and that the timing is still the same within the exams.
Locales
Our three exams use exactly the same locales. We can therefore move the locales field to a default file.
The locales field of an exam can be specified in a file named locales.yaml
in the defaults
folder.
---
- name: en # custom name
numbas_locale: en-GB # English (United Kingdom)
Try compiling the exams again. You should see that the compilation works and that the locales are still the same within the exams.
Numbas Settings
Our three exams use exactly the same Numbas settings. We can therefore move the numbas_settings
field to a default file.
The numbas_settings
field of an exam can be specified in a file named numbas_settings.yaml
in the defaults
folder.
---
theme: default # use the default numbas theme
Try compiling the exams again. You should see that the compilation works and that the Numbas settings are still the same within the exams.
Resulting exam files
Our exam files are now a lot smaller. Our exam with randomisation is now:
---
type: normal
name: First Exam
question_groups:
- name: Group 1
picking_strategy:
type: all_ordered
questions:
- first_question.yaml
- first_question_with_variables.yaml
- first_question_with_randomisation.yaml
Overriding defaults
These defaults are useful to reduce the size of your exam files. However, sometimes you will want to override the default values. For example, you might want to change the show_current_marks
field of the feedback
field for a specific exam. This can easily be done without needing to specify all fields of feedback.
---
type: normal
name: First Exam
feedback:
show_current_marks: false # overrride this field
# all other feedback settings are taken from the default file
question_groups:
- name: Group 1
picking_strategy:
type: all_ordered
questions:
- first_question.yaml
- first_question_with_variables.yaml
- first_question_with_randomisation.yaml
Try compiling this exam. You should see that the compilation works and that the current total score is not shown in the exam.
You can also find the exam in the online demo.