Commit 9c62c0f5e1d359656c405ad9f57a23730ea98ad2
1 parent
df0dcb76
Exists in
master
and in
1 other branch
- fixed textarea to monospace font and tab to 4 spaces (javascript braindead).
- changed looks in some initial logs. - minor modification in learnapp database code to submit a new studenttopic. - updated demo questions. - updated BUGS.md.
Showing
4 changed files
with
24 additions
and
21 deletions
Show diff stats
BUGS.md
1 | 1 | ||
2 | BUGS: | 2 | BUGS: |
3 | 3 | ||
4 | +- forçar reload das perguntas. | ||
4 | - tabelas nas perguntas radio/checkbox não ocupam todo o espaço como em question. | 5 | - tabelas nas perguntas radio/checkbox não ocupam todo o espaço como em question. |
5 | - topicos virtuais nao deveriam aparecer. na construção da árvore os sucessores seriam ligados directamente aos predecessores. | 6 | - topicos virtuais nao deveriam aparecer. na construção da árvore os sucessores seriam ligados directamente aos predecessores. |
6 | - Criar outra estrutura organizada em capítulos (conjuntos de tópicos). Permitir capítulos de capítulos, etc. | 7 | - Criar outra estrutura organizada em capítulos (conjuntos de tópicos). Permitir capítulos de capítulos, etc. |
7 | 8 | ||
8 | - | ||
9 | - reportar comentarios após submeter. | 9 | - reportar comentarios após submeter. |
10 | -- cada topico tem uma pagina begin e uma end? | ||
11 | - pertuntas tipo tristate: (sim, não, não sei) | 10 | - pertuntas tipo tristate: (sim, não, não sei) |
12 | -- animação no final de cada topico para se perceber a transição | ||
13 | -- aumentar espaço a seguir às tabelas no texto | ||
14 | -- guardar state cada vez que topico termina | ||
15 | -- tabs em textarea nao funcionam correctamente (insere 1 espaco em vez de 4) | ||
16 | -- textarea deve mostrar no html os valores iniciais de ans, se existir | ||
17 | - detect questions in questions.yaml without ref -> error ou generate default. | 11 | - detect questions in questions.yaml without ref -> error ou generate default. |
18 | - error if demo.yaml has no topics | 12 | - error if demo.yaml has no topics |
19 | - session management. close after inactive time. | 13 | - session management. close after inactive time. |
@@ -32,9 +26,15 @@ TODO: | @@ -32,9 +26,15 @@ TODO: | ||
32 | - pymips: activar/desactivar instruções | 26 | - pymips: activar/desactivar instruções |
33 | - implementar servidor http com redirect para https. | 27 | - implementar servidor http com redirect para https. |
34 | - usar codemirror no textarea | 28 | - usar codemirror no textarea |
29 | +- ao fim de 3 tentativas com password errada, envia email com nova password. | ||
35 | 30 | ||
36 | FIXED: | 31 | FIXED: |
37 | 32 | ||
33 | +- tabs em textarea nao funcionam correctamente (insere 1 espaco em vez de 4) | ||
34 | +- guardar state cada vez que topico termina | ||
35 | +- textarea deve mostrar no html os valores iniciais de ans, se existirem | ||
36 | +- aumentar espaço a seguir às tabelas no texto | ||
37 | +- animação no final de cada topico para se perceber a transição | ||
38 | - "<" is not escaped in markdown. | 38 | - "<" is not escaped in markdown. |
39 | - Está a mostrar a solução em 'comments'!!! | 39 | - Está a mostrar a solução em 'comments'!!! |
40 | - database: answers não tem referencia para o topico, so para question_ref | 40 | - database: answers não tem referencia para o topico, so para question_ref |
demo/solar_system/questions.yaml
1 | +--- | ||
1 | 2 | ||
2 | # --------------------------------------------------------------------------- | 3 | # --------------------------------------------------------------------------- |
3 | - | 4 | - |
@@ -30,7 +31,7 @@ | @@ -30,7 +31,7 @@ | ||
30 | ref: saturn | 31 | ref: saturn |
31 | type: text-regex | 32 | type: text-regex |
32 | title: Sistema solar | 33 | title: Sistema solar |
33 | - text: O planeta do nosso sistema solar conhecido por ter aneis chama-se planeta... | 34 | + text: O planeta do sistema solar conhecido por ter aneis é o planeta... |
34 | correct: !regex '[Ss]aturno' | 35 | correct: !regex '[Ss]aturno' |
35 | 36 | ||
36 | # --------------------------------------------------------------------------- | 37 | # --------------------------------------------------------------------------- |
@@ -41,5 +42,6 @@ | @@ -41,5 +42,6 @@ | ||
41 | text: Escreva o nome dos três planetas mais próximos do Sol. (Exemplo `A, B e C`) | 42 | text: Escreva o nome dos três planetas mais próximos do Sol. (Exemplo `A, B e C`) |
42 | correct: correct-first_3_planets.py | 43 | correct: correct-first_3_planets.py |
43 | # opcional | 44 | # opcional |
45 | + answer: Vulcano, Krypton, Plutão | ||
44 | lines: 3 | 46 | lines: 3 |
45 | timeout: 5 | 47 | timeout: 5 |
learnapp.py
@@ -118,10 +118,9 @@ class LearnApp(object): | @@ -118,10 +118,9 @@ class LearnApp(object): | ||
118 | a = s.query(StudentTopic).filter_by(student_id=uid, topic_id=finished_topic).one_or_none() | 118 | a = s.query(StudentTopic).filter_by(student_id=uid, topic_id=finished_topic).one_or_none() |
119 | if a is None: | 119 | if a is None: |
120 | # insert new studenttopic into database | 120 | # insert new studenttopic into database |
121 | - u = s.query(Student).get(uid) | ||
122 | - a = StudentTopic(level=level, date=date) | ||
123 | t = s.query(Topic).get(finished_topic) | 121 | t = s.query(Topic).get(finished_topic) |
124 | - a.topic = t | 122 | + a = StudentTopic(level=level, date=date, topic=t) |
123 | + u = s.query(Student).get(uid) | ||
125 | u.topics.append(a) | 124 | u.topics.append(a) |
126 | else: | 125 | else: |
127 | # update studenttopic in database | 126 | # update studenttopic in database |
@@ -177,9 +176,9 @@ class LearnApp(object): | @@ -177,9 +176,9 @@ class LearnApp(object): | ||
177 | logger.critical(f'Database "{db}" not usable.') | 176 | logger.critical(f'Database "{db}" not usable.') |
178 | sys.exit(1) | 177 | sys.exit(1) |
179 | else: | 178 | else: |
180 | - logger.info(f'{n:4} students.') | ||
181 | - logger.info(f'{m:4} topics.') | ||
182 | - logger.info(f'{q:4} questions answered.') | 179 | + logger.info(f'{n:6} students.') |
180 | + logger.info(f'{m:6} topics.') | ||
181 | + logger.info(f'{q:6} answers.') | ||
183 | 182 | ||
184 | # ------------------------------------------------------------------------ | 183 | # ------------------------------------------------------------------------ |
185 | # helper to manage db sessions using the `with` statement, for example | 184 | # helper to manage db sessions using the `with` statement, for example |
@@ -297,6 +296,6 @@ def build_dependency_graph(config={}): | @@ -297,6 +296,6 @@ def build_dependency_graph(config={}): | ||
297 | q['path'] = fullpath | 296 | q['path'] = fullpath |
298 | tnode['factory'][q['ref']] = QFactory(q) | 297 | tnode['factory'][q['ref']] = QFactory(q) |
299 | 298 | ||
300 | - logger.info(f'{len(tnode["questions"]):4} questions from {tref}') | 299 | + logger.info(f'{len(tnode["questions"]):6} from {tref}') |
301 | 300 | ||
302 | return g | 301 | return g |
templates/topic.html
@@ -47,8 +47,11 @@ | @@ -47,8 +47,11 @@ | ||
47 | background-color: #f5f5f5; | 47 | background-color: #f5f5f5; |
48 | } | 48 | } |
49 | html { | 49 | html { |
50 | - position: relative; | ||
51 | - min-height: 100%; | 50 | + position: relative; |
51 | + min-height: 100%; | ||
52 | + } | ||
53 | + textarea { | ||
54 | + font-family: monospace; | ||
52 | } | 55 | } |
53 | </style> | 56 | </style> |
54 | 57 | ||
@@ -131,7 +134,7 @@ | @@ -131,7 +134,7 @@ | ||
131 | } | 134 | } |
132 | }); | 135 | }); |
133 | 136 | ||
134 | - // Process the response given by the server | 137 | + // Process response given by the server |
135 | function updateQuestion(response){ | 138 | function updateQuestion(response){ |
136 | switch (response["method"]) { | 139 | switch (response["method"]) { |
137 | case "new_question": | 140 | case "new_question": |
@@ -152,7 +155,7 @@ | @@ -152,7 +155,7 @@ | ||
152 | e.preventDefault(); | 155 | e.preventDefault(); |
153 | postQuestion(); | 156 | postQuestion(); |
154 | } | 157 | } |
155 | - else if (e.keyCode === 9) { // tab | 158 | + else if (e.keyCode == 9) { // tab |
156 | e.preventDefault(); // prevent loosing focus | 159 | e.preventDefault(); // prevent loosing focus |
157 | // get caret position/selection | 160 | // get caret position/selection |
158 | var start = this.selectionStart; | 161 | var start = this.selectionStart; |
@@ -160,8 +163,7 @@ | @@ -160,8 +163,7 @@ | ||
160 | var value = $(this).val(); | 163 | var value = $(this).val(); |
161 | 164 | ||
162 | // set textarea value to: text before caret + tab + text after caret | 165 | // set textarea value to: text before caret + tab + text after caret |
163 | - $(this).val(value.substring(0, start) + " " + value.substring(end)); | ||
164 | - | 166 | + $(this).val(value.substring(0, start) + " " + " " + " " + " " + value.substring(end)); |
165 | // put caret at right position again (add one for the tab) | 167 | // put caret at right position again (add one for the tab) |
166 | this.selectionStart = this.selectionEnd = start + 4; | 168 | this.selectionStart = this.selectionEnd = start + 4; |
167 | }}); | 169 | }}); |