Commit ba69141e908e22a81c9b4ef2b08db912118659b8
1 parent
b73ff7c9
Exists in
master
and in
1 other branch
minor
Showing
3 changed files
with
6 additions
and
7 deletions
Show diff stats
aprendizations/learnapp.py
... | ... | @@ -20,6 +20,7 @@ from .questions import Question, QFactory, QDict |
20 | 20 | from .student import StudentState |
21 | 21 | from .tools import load_yaml |
22 | 22 | |
23 | + | |
23 | 24 | # setup logger for this module |
24 | 25 | logger = logging.getLogger(__name__) |
25 | 26 | |
... | ... | @@ -277,7 +278,7 @@ class LearnApp(object): |
277 | 278 | logger.warning(f'"{uid}" could not start course "{course}": {e}') |
278 | 279 | raise |
279 | 280 | else: |
280 | - logger.info(f'"{uid}" started course "{course}"') | |
281 | + logger.info(f'User "{uid}" started course "{course}"') | |
281 | 282 | |
282 | 283 | # ------------------------------------------------------------------------ |
283 | 284 | # Start new topic | ... | ... |
aprendizations/serve.py
... | ... | @@ -19,6 +19,7 @@ from tornado.escape import to_unicode |
19 | 19 | from .tools import md_to_html |
20 | 20 | from . import APP_NAME |
21 | 21 | |
22 | + | |
22 | 23 | # setup logger for this module |
23 | 24 | logger = logging.getLogger(__name__) |
24 | 25 | |
... | ... | @@ -326,15 +327,13 @@ class QuestionHandler(BaseHandler): |
326 | 327 | # --- post answer, returns what to do next: shake, new_question, finished |
327 | 328 | @tornado.web.authenticated |
328 | 329 | async def post(self) -> None: |
329 | - logger.debug('[QuestionHandler.post]') | |
330 | 330 | user = self.current_user |
331 | 331 | answer = self.get_body_arguments('answer') # list |
332 | - logger.debug(f'user = {user}, answer = {answer}') | |
332 | + qid = self.get_body_arguments('qid')[0] | |
333 | + logger.debug(f'[QuestionHandler.post] {user}, {qid}, answer={answer}') | |
333 | 334 | |
334 | 335 | # --- check if browser opened different questions simultaneously |
335 | - answer_qid = self.get_body_arguments('qid')[0] | |
336 | - current_qid = self.learn.get_current_question_id(user) | |
337 | - if answer_qid != current_qid: | |
336 | + if qid != self.learn.get_current_question_id(user): | |
338 | 337 | logger.info(f'User {user} desynchronized questions') |
339 | 338 | self.write({ |
340 | 339 | 'method': 'invalid', | ... | ... |
aprendizations/student.py
... | ... | @@ -141,7 +141,6 @@ class StudentState(object): |
141 | 141 | action = 'wrong' |
142 | 142 | if self.current_question['append_wrong']: |
143 | 143 | logger.debug('wrong answer, append new question') |
144 | - # self.questions.append(self.factory[q['ref']].generate()) | |
145 | 144 | new_question = await self.factory[q['ref']].gen_async() |
146 | 145 | self.questions.append(new_question) |
147 | 146 | self.next_question() | ... | ... |