Commit e20125b8f9839180e31ebd7e4e126a7bb27627a2

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

- minor adjustments in looks and logs

BUGS.md
1 1  
2 2 # BUGS
3 3  
  4 +- on start topic, logs show questionhandler.get() twice.
4 5 - generators e correct scripts que durem muito tempo podem bloquear o loop do tornado?
5 6 - detect questions in questions.yaml without ref -> error ou generate default.
6   -- topicos virtuais nao deveriam aparecer. na construção da árvore os sucessores seriam ligados directamente aos predecessores.
7 7 - Criar outra estrutura organizada em capítulos (conjuntos de tópicos). Permitir capítulos de capítulos, etc. talvez usar grafos de grafos...
8 8 - session management. close after inactive time.
9 9 - generators not working: bcrypt (ver blog)
... ... @@ -11,6 +11,7 @@
11 11  
12 12 # TODO
13 13  
  14 +- radio e checkboxes, aceitar numeros como seleccao das opcoes.
14 15 - each topic only loads a sample of K questions (max) in random order.
15 16 - servir imagens/ficheiros.
16 17 - pertuntas tipo tristate: (sim, não, não sei
... ...
knowledge.py
... ... @@ -54,7 +54,7 @@ class StudentKnowledge(object):
54 54 def unlock_topics(self):
55 55 # minimum level that the dependencies of a topic must have
56 56 # for the topic to be unlocked.
57   - min_level = 0.2
  57 + min_level = 0.01
58 58  
59 59 for topic in self.topic_sequence:
60 60 if topic not in self.state: # if locked
... ... @@ -89,8 +89,9 @@ class StudentKnowledge(object):
89 89 factory = self.deps.node[topic]['factory']
90 90 questionlist = self.deps.node[topic]['questions']
91 91  
92   - self.questions = [factory[qref].generate() for qref in questionlist]
93 92 self.finished_questions = []
  93 + self.questions = [factory[qref].generate() for qref in questionlist]
  94 + logger.debug(f'Total: {len(self.questions)} questions')
94 95  
95 96 try:
96 97 self.current_question = self.questions.pop(0) # FIXME crash if empty
... ...
learnapp.py
... ... @@ -58,6 +58,8 @@ class LearnApp(object):
58 58 if bcrypt.checkpw(pw.encode('utf-8'), student.password):
59 59 if uid in self.online:
60 60 logger.warning(f'User "{uid}" already logged in, overwriting state')
  61 + else:
  62 + logger.info(f'User "{uid}" logged in successfully')
61 63  
62 64 tt = s.query(StudentTopic).filter(StudentTopic.student_id == uid)
63 65 state = {t.topic_id:
... ... @@ -71,7 +73,6 @@ class LearnApp(object):
71 73 'name': student.name,
72 74 'state': StudentKnowledge(self.deps, state=state)
73 75 }
74   - logger.info(f'User "{uid}" logged in successfully')
75 76 return True
76 77  
77 78 else:
... ...
static/css/topic.css
1 1 .progress {
2 2 /*position: fixed;*/
3 3 top: 0;
4   - height: 90px;
  4 + height: 85px;
5 5 border-radius: 0px;
6 6 }
7 7 body {
8 8 margin: 0;
9 9 padding-top: 0px;
10   - margin-bottom: 90px; /* Margin bottom by footer height */
  10 + margin-bottom: 120px; /* Margin bottom by footer height */
11 11 }
12 12  
13 13 .footer {
14 14 position: absolute;
15 15 bottom: 0;
16 16 width: 100%;
17   - height: 70px;
  17 + height: 90px;
18 18 line-height: 60px;
19 19 /*background-color: #f5f5f5;*/
20 20 }
... ...