Commit e530d705a77d6a82493eae354008462cf078912a

Authored by Miguel Barao
1 parent 46d7b70a
Exists in master and in 1 other branch dev

- First login log moved from WARNING to INFO.

- Answers are always saved. Removed 'save_answers' option.
Showing 4 changed files with 5 additions and 18 deletions   Show diff stats
BUGS.md
1 1  
2 2 # BUGS
3   -- first login é INFO e não WARNING
4   -- se save_answers nao existir, da warning que nao serao gravados, mas sao sempre gravados! pagina de administracao diz --not being saved--
5 3 - se submeter um teste so com information, da divisao por zero.
6 4 - se pergunta for 'type: info' rebenta
7 5 - se um teste tiver a mesma pergunta (ref igual) varias vezes, rebenta na correcçao. As respostas são agregadas numa lista para cada ref. Ex:
... ... @@ -30,6 +28,8 @@ possivelmente as referencias das perguntas deveriam ser o "testeRef:numPergunta"
30 28  
31 29 # FIXED
32 30  
  31 +- se save_answers nao existir, da warning que nao serao gravados, mas sao sempre gravados! pagina de administracao diz --not being saved--
  32 +- first login é INFO e não WARNING
33 33 - /review não mostra imagens porque precisa que teste esteja a decorrer...
34 34 - visualizar um teste ja realizado na página de administração
35 35 - Depois da correcção, mostra testes realizados que não foram realizados pelo próprio
... ...
app.py
... ... @@ -82,7 +82,7 @@ class App(object):
82 82 hashed_pw = bcrypt.hashpw(try_pw.encode('utf-8'), bcrypt.gensalt())
83 83 student.password = hashed_pw
84 84 s.commit()
85   - logger.warning('Student {}: first login, password updated.'.format(uid))
  85 + logger.info('Student {}: first login, password updated.'.format(uid))
86 86  
87 87 elif bcrypt.hashpw(try_pw.encode('utf-8'), student.password) != student.password:
88 88 # wrong password
... ...
static/js/admin.js
... ... @@ -145,12 +145,7 @@ $(document).ready(function() {
145 145 $("#ref").html(data['test']['ref']);
146 146 $("#filename").html(data['test']['filename']);
147 147 $("#database").html(data['test']['database']);
148   - if (data['test']['save_answers']) {
149   - $("#answers_dir").html(data['test']['answers_dir']);
150   - }
151   - else {
152   - $("#answers_dir").html('--- not being saved ---');
153   - }
  148 + $("#answers_dir").html(data['test']['answers_dir']);
154 149  
155 150 // fill online and student tables
156 151 populateOnlineTable(data["students"]);
... ...
test.py
... ... @@ -75,10 +75,8 @@ class TestFactory(dict):
75 75  
76 76 if 'ref' not in self:
77 77 logger.warning('Missing "ref". Will use current date/time.')
78   - if 'answers_dir' not in self and self.get('save_answers', False):
  78 + if 'answers_dir' not in self:
79 79 logger.warning('Missing "answers_dir". Will use current directory!')
80   - if 'save_answers' not in self:
81   - logger.warning('Missing "save_answers". Answers will NOT be saved!')
82 80 if 'questions_dir' not in self:
83 81 logger.warning('Missing "questions_dir". Using {}'.format(path.abspath(path.curdir)))
84 82 if 'files' not in self:
... ... @@ -92,7 +90,6 @@ class TestFactory(dict):
92 90 self.setdefault('debug', False)
93 91 self.setdefault('show_ref', False)
94 92 self.setdefault('questions_dir', path.curdir)
95   - self.setdefault('save_answers', False)
96 93 self.setdefault('answers_dir', path.curdir)
97 94 self['database'] = path.abspath(path.expanduser(self['database']))
98 95 self['questions_dir'] = path.abspath(path.expanduser(self['questions_dir']))
... ... @@ -134,8 +131,6 @@ class TestFactory(dict):
134 131 # normalize questions to a list of dictionaries
135 132 # -----------------------------------------------------------------------
136 133 def normalize_questions(self):
137   -
138   - # print(self['questions'])
139 134 for i, q in enumerate(self['questions']):
140 135 # normalize question to a dict and ref to a list of references
141 136 if isinstance(q, str):
... ... @@ -144,7 +139,6 @@ class TestFactory(dict):
144 139 q['ref'] = [q['ref']]
145 140  
146 141 self['questions'][i] = q
147   - # print(self['questions'])
148 142  
149 143 # -----------------------------------------------------------------------
150 144 # Given a dictionary with a student id {'name':'john', 'number': 123}
... ... @@ -172,11 +166,9 @@ class TestFactory(dict):
172 166 'title': self['title'], # title of the test
173 167 'student': student, # student id
174 168 'questions': test, # list of questions
175   - 'save_answers': self['save_answers'],
176 169 'answers_dir': self['answers_dir'],
177 170  
178 171 # FIXME which ones are required?
179   - # 'practice': self['practice'], # FIXME remove?
180 172 'show_hints': self['show_hints'],
181 173 'show_points': self['show_points'],
182 174 'show_ref': self['show_ref'],
... ...