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
@@ -11,8 +11,7 @@ The database can be initialized from a list of students in CSV format using the @@ -11,8 +11,7 @@ The database can be initialized from a list of students in CSV format using the
11 $ ./initdb_from_csv.py list_of_students.csv 11 $ ./initdb_from_csv.py list_of_students.csv
12 12
13 This script will create a new sqlite3 database with the correct tables and insert the students with empty passwords. 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 ### Create new questions 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,16 +116,16 @@ Some of the options have default values if they are omitted. The defaults are th
117 debug: False 116 debug: False
118 points: 1.0 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 ### Running an existing test 119 ### Running an existing test
125 120
126 A test is a file in `yaml` format. Just run `serve.py` with the test to run as argument: 121 A test is a file in `yaml` format. Just run `serve.py` with the test to run as argument:
127 122
128 $ ./serve.py tests_dir/mytest.yaml 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 To terminate the test just do `^C` on the keyboard. 129 To terminate the test just do `^C` on the keyboard.
131 130
132 ## Questions 131 ## Questions
@@ -113,13 +113,14 @@ class Root(object): @@ -113,13 +113,14 @@ class Root(object):
113 t.update_answers(ans) 113 t.update_answers(ans)
114 t.correct() 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 if t['practice_mode']: 120 if t['practice_mode']:
117 raise cherrypy.HTTPRedirect('/test') 121 raise cherrypy.HTTPRedirect('/test')
118 122
119 else: 123 else:
120 - if t['save_answers']:  
121 - t.save_json(self.testconf['answers_dir'])  
122 - self.database.save_test(t)  
123 124
124 # ---- Expire session ---- 125 # ---- Expire session ----
125 self.loggedin.discard(t['number']) 126 self.loggedin.discard(t['number'])