Commit c725ad3d774b5dcf3b1b841b2650d6c76de4c640
1 parent
18f3abd6
Exists in
master
and in
1 other branch
- topics can be started by clicking anywhere in the table row
- updated QUESTIONS.md
Showing
3 changed files
with
26 additions
and
20 deletions
Show diff stats
QUESTIONS.md
1 | # Questions | 1 | # Questions |
2 | 2 | ||
3 | -Questions are saved in files in the [YAML](http://www.yaml.org/start.html) format. Each file has a list of questions with the following structure: | 3 | +Questions are saved in files in the [YAML](http://www.yaml.org/start.html) format. Each file contains a list of questions like |
4 | 4 | ||
5 | ```yaml | 5 | ```yaml |
6 | - type: radio | 6 | - type: radio |
7 | - ref: question1 | 7 | + ref: myquestion1 |
8 | ... | 8 | ... |
9 | 9 | ||
10 | - type: checkbox | 10 | - type: checkbox |
11 | - ref: question2 | 11 | + ref: myquestion2 |
12 | ... | 12 | ... |
13 | ``` | 13 | ``` |
14 | 14 | ||
15 | -The following kinds kinds of questions are supported: | 15 | +where each question is specified in a dictionary. |
16 | +The `type` key is mandatory and specifies the type of question (multiple choice, text, etc). | ||
17 | +The other keys available will depend on the type of question. | ||
18 | +The field `ref` is not strictly required but still recommended, if not defined it will default to a string with the filename and the question index, e.g., `questions.yaml:12`. | ||
19 | + | ||
20 | +The following types of questions are supported: | ||
16 | 21 | ||
17 | type | kind of answer | 22 | type | kind of answer |
18 | -----|----------------- | 23 | -----|----------------- |
19 | -[radio](#radio) | Choose exactly one option from list of options. | 24 | +[radio](#radio) | Choose exactly one option from a list of options. |
20 | [checkbox](#checkbox) | Choose zero, one or more options. | 25 | [checkbox](#checkbox) | Choose zero, one or more options. |
21 | -[text](#text) | Line of text which is matched against a list of acceptable answers. | 26 | +[text](#text) | Line of text which is compared against a list of acceptable answers. |
22 | [text-regex](#text-regex) | Similar to text, but the answer is validated by a regular expression. | 27 | [text-regex](#text-regex) | Similar to text, but the answer is validated by a regular expression. |
23 | -[numeric-interval](#numeric-interval) | Answer is interpreted as a floating point value (e.g. `1.2e-3`), which is checked against a closed interval. | ||
24 | -[textarea](#textarea) | The answer is a multiline block of text that is sent to an external program for assessment. The printed output of the external program is parsed to obtain the result. | ||
25 | -[information, warning, alert and success](#information-warning-alert-and-success) | These are not really questions, just information panels intended to be used in tests to convey information. There is no answer and it's always correct. | ||
26 | -[generator](#generator) | This is not a really a question type. It means that this question will be generated by an external program, and the actual type is defined there. | 28 | +[numeric-interval](#numeric-interval) | Answer is interpreted as a floating point value (e.g. `1.2e-3`), and is checked against a closed interval. |
29 | +[textarea](#textarea) | The answer is a multiline block of text that is sent to an external program for assessment. The printed output of the external program is parsed (yaml) to obtain the result. | ||
30 | +[information, warning, alert, success](#information-warning-alert-and-success) | These are not really questions, just information panels intended to be used to convey information. There is no space for an answer and the correction returns always correct. | ||
31 | +[generator](#generator) | This is not a real question type. It means that this question will be generated by an external program, and the actual type is defined there. | ||
27 | 32 | ||
28 | -In all questions, the field `type` is required. The field `ref` is not strictly required but still recommended, if not defined will default to FIXME. | 33 | +## Question types |
29 | 34 | ||
30 | -## radio | 35 | +### radio |
31 | 36 | ||
32 | Only one option can be selected as the answer. If no option is selected, the question is considered unanswered. | 37 | Only one option can be selected as the answer. If no option is selected, the question is considered unanswered. |
33 | 38 | ||
@@ -53,18 +58,18 @@ All fields are optional except `type` and `options`. `title` and `text` default | @@ -53,18 +58,18 @@ All fields are optional except `type` and `options`. `title` and `text` default | ||
53 | 58 | ||
54 | The `correct` field can be used in multiple ways and in combination with `shuffle`, `discount` and `choose` fields: | 59 | The `correct` field can be used in multiple ways and in combination with `shuffle`, `discount` and `choose` fields: |
55 | 60 | ||
56 | -- if not present, the first option is considered correct (options are usually shuffled...). | ||
57 | -- it can be the index (0-based) of the correct option, e.g., `correct: 0`. | 61 | +- if not present, the first option is considered correct (options are shuffled by default when presented to the student). |
62 | +- it can be the index (0-based) of the correct option, e.g., `correct: 0` for the first option. | ||
58 | - it can be a list of numbers between 0 and 1, e.g., `correct: [1, 0, 0]`. In this case, the first option is 100% correct while the others are 0%. If `discount: true` (the default), then the wrong ones will be penalized by $-1/(n-1)=-\tfrac{1}{2}$, where $n$ is the number of options. | 63 | - it can be a list of numbers between 0 and 1, e.g., `correct: [1, 0, 0]`. In this case, the first option is 100% correct while the others are 0%. If `discount: true` (the default), then the wrong ones will be penalized by $-1/(n-1)=-\tfrac{1}{2}$, where $n$ is the number of options. |
59 | - there can be more than one correct option in the list, which is then marked in the correct field, e.g. `correct: [1, 1, 0]`. In this case, one of the correct options will be randomly selected, and the remaining wrong ones appended. | 64 | - there can be more than one correct option in the list, which is then marked in the correct field, e.g. `correct: [1, 1, 0]`. In this case, one of the correct options will be randomly selected, and the remaining wrong ones appended. |
60 | - there can also be a long list of right and wrong options from which to build the question options. E.g. if `correct: [1,1,1,0,0,0,0]` and `choose: 3` is defined, then 1 correct option and 2 wrong ones are randomly selected from the list. | 65 | - there can also be a long list of right and wrong options from which to build the question options. E.g. if `correct: [1,1,1,0,0,0,0]` and `choose: 3` is defined, then 1 correct option and 2 wrong ones are randomly selected from the list. |
61 | - finally it's also possible to have a question that is *"not-completely-right"* or *"not-completely-wrong"*. This can be done using numbers between 0 and 1, e.g., `correct: [1, 0.3, 0]`. This practice is discouraged. | 66 | - finally it's also possible to have a question that is *"not-completely-right"* or *"not-completely-wrong"*. This can be done using numbers between 0 and 1, e.g., `correct: [1, 0.3, 0]`. This practice is discouraged. |
62 | 67 | ||
63 | -In some situations one may not want the options to be shuffled, e.g., if they show several steps of a proof and the student should mark the wrong step. In that case use `shuffle: false`. | 68 | +In some situations one may not want the options to be shuffled. In that case use `shuffle: false`. |
64 | 69 | ||
65 | -## checkbox | 70 | +### checkbox |
66 | 71 | ||
67 | -Zero, one or multiple options can be selected. The question is always considered as answered, even if no options are selected, which is also a valid answed. | 72 | +Zero, one or multiple options can be selected. The question is always considered as answered, even if no options are selected. |
68 | 73 | ||
69 | The simplest format is | 74 | The simplest format is |
70 | 75 |
static/js/maintopics.js
@@ -29,4 +29,7 @@ function change_password() { | @@ -29,4 +29,7 @@ function change_password() { | ||
29 | 29 | ||
30 | $(document).ready(function() { | 30 | $(document).ready(function() { |
31 | $("#change_password").click(change_password); | 31 | $("#change_password").click(change_password); |
32 | + $(".clickable-row").click(function () { | ||
33 | + window.location = $(this).data("href"); | ||
34 | + }); | ||
32 | }); | 35 | }); |
templates/maintopics-table.html
@@ -87,7 +87,7 @@ | @@ -87,7 +87,7 @@ | ||
87 | </tr> | 87 | </tr> |
88 | 88 | ||
89 | {% else %} | 89 | {% else %} |
90 | - <tr> | 90 | + <tr class="clickable-row" data-href="/topic/{{t['ref']}}"> |
91 | <td class="text-primary"> | 91 | <td class="text-primary"> |
92 | {% if t['type']=='chapter' %} | 92 | {% if t['type']=='chapter' %} |
93 | <div class="lead"> | 93 | <div class="lead"> |
@@ -98,7 +98,6 @@ | @@ -98,7 +98,6 @@ | ||
98 | {% end %} | 98 | {% end %} |
99 | </td> | 99 | </td> |
100 | <td class="text-center"> | 100 | <td class="text-center"> |
101 | - <a href="/topic/{{t['ref']}}"> | ||
102 | {% if t['level'] < 0.01 %} | 101 | {% if t['level'] < 0.01 %} |
103 | <i class="fas fa-lock-open text-success"></i> | 102 | <i class="fas fa-lock-open text-success"></i> |
104 | {% elif t['type']=='chapter' %} | 103 | {% elif t['type']=='chapter' %} |
@@ -112,7 +111,6 @@ | @@ -112,7 +111,6 @@ | ||
112 | </span> | 111 | </span> |
113 | </div> | 112 | </div> |
114 | {% end %} | 113 | {% end %} |
115 | - </a> | ||
116 | </td> | 114 | </td> |
117 | </tr> | 115 | </tr> |
118 | {% end %} | 116 | {% end %} |