Commit 2285f4a5425c4693642eed4e79eacf1fd5218a3c
1 parent
45cffaba
Exists in
master
and in
1 other branch
- fixed finished topic was not being saved in the database
Showing
3 changed files
with
6 additions
and
2 deletions
Show diff stats
BUGS.md
... | ... | @@ -34,6 +34,7 @@ |
34 | 34 | |
35 | 35 | # FIXED |
36 | 36 | |
37 | +- não está a guardar o resultado no final do topico | |
37 | 38 | - esta a permitir 2 logins em simultaneo do mesmo user. fica tudo baralhado se mxerem em simultaneo... |
38 | 39 | - errar no ultimo topico nao mostra solucao? |
39 | 40 | - quando a pergunta devolve comments, este é apresentado, mas fica persistente nas tentativas seguintes. devia ser limpo apos a segunda submissao. | ... | ... |
knowledge.py
... | ... | @@ -177,6 +177,9 @@ class StudentKnowledge(object): |
177 | 177 | # pure functions of the state (no side effects) |
178 | 178 | # ======================================================================== |
179 | 179 | |
180 | + def topic_has_finished(self): | |
181 | + return self.current_question is None | |
182 | + | |
180 | 183 | # ------------------------------------------------------------------------ |
181 | 184 | # compute recommended sequence of topics ['a', 'b', ...] |
182 | 185 | # ------------------------------------------------------------------------ | ... | ... |
learnapp.py
... | ... | @@ -81,7 +81,7 @@ class LearnApp(object): |
81 | 81 | return False |
82 | 82 | |
83 | 83 | pw_ok = await check_password(try_pw, password) # async bcrypt |
84 | - | |
84 | + | |
85 | 85 | if pw_ok: |
86 | 86 | if uid in self.online: |
87 | 87 | logger.warning(f'User "{uid}" already logged in, overwriting') |
... | ... | @@ -153,7 +153,7 @@ class LearnApp(object): |
153 | 153 | topic_id=topic)) |
154 | 154 | logger.debug(f'Saved "{q["ref"]}" into database') |
155 | 155 | |
156 | - if action == 'finished_topic': | |
156 | + if knowledge.topic_has_finished(): | |
157 | 157 | # finished topic, save into database |
158 | 158 | logger.info(f'User "{uid}" finished "{topic}"') |
159 | 159 | level = knowledge.get_topic_level(topic) | ... | ... |