# Perguntations user manual ~ [Miguel BarĂ£o](mjsb@uevora.pt) ~ ## Quick start After installing python and the required packages as described in the `README.md` we can run a demonstration: ```.bash $ cd PATH/TO/perguntations $ ./initdb.py --demo New database created: students.db 8 user(s) inserted: 0 - Professor (administrator) 1815 - Ada Lovelace ... ... 1969 - Linus Torvalds$ mv students.db demo/ $ mv students.db demo/ $ mkdir demo/ans $ ./serve.py demo/test.yaml 2017-11-02 10:39:29,683 | INFO | root | =============================================== 2017-11-02 10:39:29,683 | INFO | app | Starting application 2017-11-02 10:39:29,684 | INFO | app | Loading test configuration "demo/test-tutorial.yaml". 2017-11-02 10:39:29,786 | INFO | questions | Loaded 10 questions from "questions-tutorial.yaml". 2017-11-02 10:39:29,787 | INFO | test | Checking question "tut-information". 2017-11-02 10:39:29,787 | INFO | test | Checking question "tut-success". 2017-11-02 10:39:29,787 | INFO | test | Checking question "tut-warning". 2017-11-02 10:39:29,788 | INFO | test | Checking question "tut-alert". 2017-11-02 10:39:29,788 | INFO | test | Checking question "tut-radio". 2017-11-02 10:39:29,788 | INFO | test | Checking question "tut-checkbox". 2017-11-02 10:39:29,789 | INFO | test | Checking question "tut-text". 2017-11-02 10:39:29,789 | INFO | test | Checking question "tut-text-regex". 2017-11-02 10:39:29,789 | INFO | test | Checking question "tut-numeric-interval". 2017-11-02 10:39:29,790 | INFO | test | Checking question "tut-textarea". 2017-11-02 10:39:29,790 | INFO | test | Test factory ready for "tutorial". 2017-11-02 10:39:29,880 | INFO | app | Database has 34 students registered. 2017-11-02 10:39:29,891 | INFO | root | Webserver running... ``` You can now open a browser and point it to the server address, e.g. `http://127.0.0.1:8443`. Enter `0` for the number and choose any password. This will be your password from now on. After login, you will see an administrator page. This page allows you to: - **Allow students** to login to the test. This can be done one at a time, using the checkboxes on the left of each student, or allow all students by clicking the menubar. - **Review a test** done by a student by clicking the grade colorbar on the right. If a student has multiple tests, then several bars will be shown. A tooltip shows the date/time for each test. - **Reset passwords**. Students that already have a password will have a key icon next to the student name. To reset the password, go to the menubar `alunos`. The key icon will disappear. - Online students will have a label with the staring time next to the name. ~~- If a student moves unfocus the browser window on his computer (e.g. for cheating), a red bar appears along with the status `unfocus`. Screen saver is also reported as unfocus, so some care should be taken...~~ - **Add new students** on the menu `alunos`. ## Answering a test Students are redirected to a test as soon as they login. The test is a single page showing all questions. If an answer to a question is unknown, the question can be disabled on the top right corner to avoid penalties. After answering all the questions, the test is submited by clicking the green button on the bottom of the page. A new page is shown with the grade obtained. At this point the test is terminated and the student has already been logged out. ## Creating a new test A test is specified in a single `yaml` file. Look at `demo/test.yaml` for an example and documentation. ## Creating questions Questions are defined in `yaml` files. Each `yaml` file contains a list of questions that can be selected to make up a test. The types of questions supported are: - `radio` are single choice questions. - `checkbox` are multiple choice where multiple options can be selected. - `text` answers have one line of text, which is checked against a list of possible accepted answers. - `text-regex` is similar to `text` but answers are checked by a regular expression. - `numeric-interval` provides a line of text where a number can be written. Numbers are converted to a float and checked if they belong to an interval. - `textarea` provide a multiline text box to write the answer (e.g. for computer code). The answer is corrected by calling an external program that is not part of the server and is up to you to develop. Besides these, there are `information`, `warning` and `alert` types which just show text and do not expect answers. All the types above are predifined questions. It is also possible to generate questions of any type. These are defined with type `generator` and an external program must be provided to generate a question of the types above. An example file with these types of questions is provided in `demo/questions/questions.yaml` along with accompanying files under the directory `demo/questions`. ## Validating a new test Tests should be validated carefully before running a test in production one should test it very carefully. After writing the questions and the test configuration, it's recommended to: 1. Create a database for debug with `./initdb.py --demo`. 2. Run the server with `./serve.py --allow-all new_test.yaml` where the `--allow-all` option avoids having to use a second browser for the admin page to explicitly allow a student. 3. If bugs are found, try commenting questions in the `new_test.yaml` to isolate the bug. Use the `--debug` option to see more information on what is happening. ## Reviewing tests The actual tests are saved as individual JSON files. These files are stored in the location `answers_dir` specified in the `test.yaml` configuration file. To review the tests: 1. Run the server with the test to review 2. Login as user `0`. 3. Click on a colored grade bar to open the test ## Getting the grades The grades are stored in the sqlite3 file specified in the test. We can get the results into a csv file and later import it into LibreOffice: ```.bash $ sqlite3 demo/students.db "select student_id,grade from tests where ref='my-test-reference'" > grades.csv ```