Commit ba69141e908e22a81c9b4ef2b08db912118659b8

Authored by Miguel Barão
1 parent b73ff7c9
Exists in master and in 1 other branch dev

minor

aprendizations/learnapp.py
@@ -20,6 +20,7 @@ from .questions import Question, QFactory, QDict @@ -20,6 +20,7 @@ from .questions import Question, QFactory, QDict
20 from .student import StudentState 20 from .student import StudentState
21 from .tools import load_yaml 21 from .tools import load_yaml
22 22
  23 +
23 # setup logger for this module 24 # setup logger for this module
24 logger = logging.getLogger(__name__) 25 logger = logging.getLogger(__name__)
25 26
@@ -277,7 +278,7 @@ class LearnApp(object): @@ -277,7 +278,7 @@ class LearnApp(object):
277 logger.warning(f'"{uid}" could not start course "{course}": {e}') 278 logger.warning(f'"{uid}" could not start course "{course}": {e}')
278 raise 279 raise
279 else: 280 else:
280 - logger.info(f'"{uid}" started course "{course}"') 281 + logger.info(f'User "{uid}" started course "{course}"')
281 282
282 # ------------------------------------------------------------------------ 283 # ------------------------------------------------------------------------
283 # Start new topic 284 # Start new topic
aprendizations/serve.py
@@ -19,6 +19,7 @@ from tornado.escape import to_unicode @@ -19,6 +19,7 @@ from tornado.escape import to_unicode
19 from .tools import md_to_html 19 from .tools import md_to_html
20 from . import APP_NAME 20 from . import APP_NAME
21 21
  22 +
22 # setup logger for this module 23 # setup logger for this module
23 logger = logging.getLogger(__name__) 24 logger = logging.getLogger(__name__)
24 25
@@ -326,15 +327,13 @@ class QuestionHandler(BaseHandler): @@ -326,15 +327,13 @@ class QuestionHandler(BaseHandler):
326 # --- post answer, returns what to do next: shake, new_question, finished 327 # --- post answer, returns what to do next: shake, new_question, finished
327 @tornado.web.authenticated 328 @tornado.web.authenticated
328 async def post(self) -> None: 329 async def post(self) -> None:
329 - logger.debug('[QuestionHandler.post]')  
330 user = self.current_user 330 user = self.current_user
331 answer = self.get_body_arguments('answer') # list 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 # --- check if browser opened different questions simultaneously 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 logger.info(f'User {user} desynchronized questions') 337 logger.info(f'User {user} desynchronized questions')
339 self.write({ 338 self.write({
340 'method': 'invalid', 339 'method': 'invalid',
aprendizations/student.py
@@ -141,7 +141,6 @@ class StudentState(object): @@ -141,7 +141,6 @@ class StudentState(object):
141 action = 'wrong' 141 action = 'wrong'
142 if self.current_question['append_wrong']: 142 if self.current_question['append_wrong']:
143 logger.debug('wrong answer, append new question') 143 logger.debug('wrong answer, append new question')
144 - # self.questions.append(self.factory[q['ref']].generate())  
145 new_question = await self.factory[q['ref']].gen_async() 144 new_question = await self.factory[q['ref']].gen_async()
146 self.questions.append(new_question) 145 self.questions.append(new_question)
147 self.next_question() 146 self.next_question()