Commit d69df6c53b70b6faa71d248c9af60c1ff60ab44b

Authored by Miguel Barao
1 parent 5efd9c3c
Exists in master and in 1 other branch dev

- practice_mode wasnt allowing to store ans and database. Fixed.

Showing 2 changed files with 9 additions and 9 deletions   Show diff stats
MANUAL.md
... ... @@ -11,8 +11,7 @@ The database can be initialized from a list of students in CSV format using the
11 11 $ ./initdb_from_csv.py list_of_students.csv
12 12  
13 13 This script will create a new sqlite3 database with the correct tables and insert the students with empty passwords.
14   -
15   -There is also a special user with number 0. This is the administrator user.
  14 +It also adds a special user number 0. This is the administrator user (Professor).
16 15  
17 16 ### Create new questions
18 17  
... ... @@ -117,16 +116,16 @@ Some of the options have default values if they are omitted. The defaults are th
117 116 debug: False
118 117 points: 1.0
119 118  
120   -The defaults and the values defined in the yaml file can also be overriden on command line options. Example
121   -
122   - $ ./serve.py --debug --show_points --show_hints --practice_mode mytest.yaml
123   -
124 119 ### Running an existing test
125 120  
126 121 A test is a file in `yaml` format. Just run `serve.py` with the test to run as argument:
127 122  
128 123 $ ./serve.py tests_dir/mytest.yaml
129 124  
  125 +Some defaults can be overriden with command line options. Example
  126 +
  127 + $ ./serve.py mytest.yaml --debug --show_points --show_hints --practice_mode --save_answers
  128 +
130 129 To terminate the test just do `^C` on the keyboard.
131 130  
132 131 ## Questions
... ...
serve.py
... ... @@ -113,13 +113,14 @@ class Root(object):
113 113 t.update_answers(ans)
114 114 t.correct()
115 115  
  116 + if t['save_answers']:
  117 + t.save_json(self.testconf['answers_dir'])
  118 + self.database.save_test(t)
  119 +
116 120 if t['practice_mode']:
117 121 raise cherrypy.HTTPRedirect('/test')
118 122  
119 123 else:
120   - if t['save_answers']:
121   - t.save_json(self.testconf['answers_dir'])
122   - self.database.save_test(t)
123 124  
124 125 # ---- Expire session ----
125 126 self.loggedin.discard(t['number'])
... ...