|
1 | 1 | # Shared Models App |
2 | 2 |
|
3 | 3 | ## Overview and Motivation |
| 4 | + |
4 | 5 | The `shared_models` app is designed to hold the models and serializers that need to be used across multiple apps. This is to allow them to all access the same underlying models that don't belong to a single app, rather than having their own versions of these models and accessing each other's at random. |
5 | 6 |
|
6 | 7 | ## Models |
| 8 | + |
7 | 9 | ### Quiz |
| 10 | + |
8 | 11 | There are three shared quiz models: |
| 12 | + |
9 | 13 | * Question - a model representing a generic quiz question. Questions come in three types (represented by the `question_type` field): multiple choice, numerical answer and short answer. |
10 | 14 | * Tag - a model representing a generic tag which can be attached to many Questions (and each Question may have many associated Tags). Example Tags would include the subject and unit of study the question pertains to, as well as the topic within that subject/unit. Tags will be able to be created and modified by admins for regular users to use to tag their questions. |
11 | 15 | * Answer - a model representing an answer associated with a particular Question. Each Question can have multiple associated answers. Each answer can be marked as being correct or incorrect. For the three different types of Question, the intended use of the Answer model varies: |
12 | | - * For multiple choice questions, each Answer will appear as an option for the user taking the quiz to select. One or more Answers will be correct, and the remaining Answers will be incorrect. |
13 | | - * For numerical answer questions, no options will be displayed, and the user must enter a numerical value into a text field. Each of the Answers associated with such a Question should have `is_correct = True`, and if the user's input matches any of these answers, they will be marked correct. Answers which have `is_correct = False` will not do anything and hence **should not be added** to numerical answer questions. |
14 | | - * For short answer questions, the user will be given an extended text field to enter their answer into. Due to the nature of this question, automated marking is not possible, and so the user will have to self-mark their response. Upon submitting their answer, all Answers associated to the Question with `is_correct = True` will be displayed for the user to compare their response to. As with numerical answer questions, Answers with `is_correct = False` will not do anything and hence **should not be added**. |
| 16 | + * For multiple choice questions, each Answer will appear as an option for the user taking the quiz to select. One or more Answers will be correct, and the remaining Answers will be incorrect. |
| 17 | + * For numerical answer questions, no options will be displayed, and the user must enter a numerical value into a text field. Each of the Answers associated with such a Question should have `is_correct = True`, and if the user's input matches any of these answers, they will be marked correct. Answers which have `is_correct = False` will not do anything and hence **should not be added** to numerical answer questions. |
| 18 | + * For short answer questions, the user will be given an extended text field to enter their answer into. Due to the nature of this question, automated marking is not possible, and so the user will have to self-mark their response. Upon submitting their answer, all Answers associated to the Question with `is_correct = True` will be displayed for the user to compare their response to. As with numerical answer questions, Answers with `is_correct = False` will not do anything and hence **should not be added**. |
15 | 19 |
|
16 | 20 | ### Statistics |
| 21 | + |
17 | 22 | * QuestionResponse - a model representing a response to a Question submitted by a User, stored in the database for statistics purposes. The QuestionResponse model contains all of the necessary data for the following statistics to be surmised, as per the client's requirements: |
18 | | - * How long the User took to complete the Question |
19 | | - * How many Users in total have attempted a given Question |
20 | | - * How many Users have gotten the Question right and how many have gotten it wrong |
21 | | - * The average score (across all Users) for a given Question |
22 | | - * The average score (across all Users) for a given Tag (i.e. subject and topic) |
| 23 | + * How long the User took to complete the Question |
| 24 | + * How many Users in total have attempted a given Question |
| 25 | + * How many Users have gotten the Question right and how many have gotten it wrong |
| 26 | + * The average score (across all Users) for a given Question |
| 27 | + * The average score (across all Users) for a given Tag (i.e. subject and topic) |
23 | 28 |
|
24 | 29 | ## Serializers |
| 30 | + |
25 | 31 | The `shared_models` app provides serializers for each of the above models. |
26 | 32 |
|
27 | 33 | ## Testing |
28 | | -Unit tests can be run from within the backend Docker container using the command `python manage.py test` (more verbosely if executing from a terminal not SSH'd into the container: `docker exec -it elucidate_server python manage.py test`). Ensure you are executing the command from the same directory as `manage.py`. |
29 | 34 |
|
| 35 | +Unit tests can be run from within the backend Docker container using the command `python manage.py test` (more verbosely if executing from a terminal not SSH'd into the container: `docker exec -it elucidate_server python manage.py test`). Ensure you are executing the command from the same directory as `manage.py`. |
0 commit comments