Commit 286e40cd281f0d61749b24a79ca7f65e005c19a4
1 parent
dbbd7c2a
Exists in
master
and in
1 other branch
fix error where questions points were being ignored.
Showing
3 changed files
with
19 additions
and
12 deletions
Show diff stats
.gitignore
| @@ -9,4 +9,7 @@ static/lib | @@ -9,4 +9,7 @@ static/lib | ||
| 9 | /*.eggnode_modules | 9 | /*.eggnode_modules |
| 10 | 10 | ||
| 11 | # ignore javascript libraries installed with npm | 11 | # ignore javascript libraries installed with npm |
| 12 | -node_modules/ | ||
| 13 | \ No newline at end of file | 12 | \ No newline at end of file |
| 13 | +node_modules/ | ||
| 14 | + | ||
| 15 | +# ignore documentation until it is actually written | ||
| 16 | +doc/ | ||
| 14 | \ No newline at end of file | 17 | \ No newline at end of file |
BUGS.md
| 1 | 1 | ||
| 2 | # BUGS | 2 | # BUGS |
| 3 | 3 | ||
| 4 | -- quando se clica no texto de uma opcao, salta para outro lado na pagina. | 4 | +- nao esta a usar points das perguntas |
| 5 | +- teste nao esta a mostrar imagens. | ||
| 6 | +- se houver erros a abrir ficheiros .yaml de perguntas, depois dos testes diz "No errors found". | ||
| 7 | +- dizer quanto desconta em cada pergunta de escolha multipla | ||
| 5 | - ordenacao das notas em /admin nao é numerica, é ascii... | 8 | - ordenacao das notas em /admin nao é numerica, é ascii... |
| 6 | - mensagems de erro do assembler aparecem na mesma linha na correcao e nao fazerm rendering do `$t`, ver se servidor faz parse do markdown dessas mensagens. | 9 | - mensagems de erro do assembler aparecem na mesma linha na correcao e nao fazerm rendering do `$t`, ver se servidor faz parse do markdown dessas mensagens. |
| 7 | - impedir os eventos copy/paste. alunos usam isso para trazer codigo ja feito nos computadores. Obrigar a fazer reset? fazer um copy automaticamente? | 10 | - impedir os eventos copy/paste. alunos usam isso para trazer codigo ja feito nos computadores. Obrigar a fazer reset? fazer um copy automaticamente? |
| @@ -12,6 +15,7 @@ ou usar push (websockets?) | @@ -12,6 +15,7 @@ ou usar push (websockets?) | ||
| 12 | - lidar com eventos unfocus. | 15 | - lidar com eventos unfocus. |
| 13 | - servidor nao esta a lidar com eventos scroll/resize. ignorar? | 16 | - servidor nao esta a lidar com eventos scroll/resize. ignorar? |
| 14 | - Test.reset_answers() unused. | 17 | - Test.reset_answers() unused. |
| 18 | +- mudar ref do test para test_id (ref já é usado nas perguntas) | ||
| 15 | 19 | ||
| 16 | # TODO | 20 | # TODO |
| 17 | 21 | ||
| @@ -54,6 +58,7 @@ ou usar push (websockets?) | @@ -54,6 +58,7 @@ ou usar push (websockets?) | ||
| 54 | 58 | ||
| 55 | # FIXED | 59 | # FIXED |
| 56 | 60 | ||
| 61 | +- quando se clica no texto de uma opcao, salta para outro lado na pagina. | ||
| 57 | - suportar cotacao to teste diferente de 20 (e.g. para juntar perguntas em papel). opcao "points: 18" que normaliza total para 18 em vez de 20. | 62 | - suportar cotacao to teste diferente de 20 (e.g. para juntar perguntas em papel). opcao "points: 18" que normaliza total para 18 em vez de 20. |
| 58 | - fazer package para instalar perguntations com pip. | 63 | - fazer package para instalar perguntations com pip. |
| 59 | - pymips: nao pode executar syscalls do spim. | 64 | - pymips: nao pode executar syscalls do spim. |
perguntations/test.py
| @@ -133,13 +133,11 @@ class TestFactory(dict): | @@ -133,13 +133,11 @@ class TestFactory(dict): | ||
| 133 | 133 | ||
| 134 | testfile = path.join(path.expanduser(self['answers_dir']), 'REMOVE-ME') | 134 | testfile = path.join(path.expanduser(self['answers_dir']), 'REMOVE-ME') |
| 135 | try: # check if answers_dir is a writable directory | 135 | try: # check if answers_dir is a writable directory |
| 136 | - f = open(testfile, 'w') | 136 | + with open(testfile, 'w') as f: |
| 137 | + f.write('You can safely remove this file.') | ||
| 137 | except OSError: | 138 | except OSError: |
| 138 | logger.critical(f'Can\'t write answers to "{self["answers_dir"]}"') | 139 | logger.critical(f'Can\'t write answers to "{self["answers_dir"]}"') |
| 139 | raise TestFactoryException() | 140 | raise TestFactoryException() |
| 140 | - else: | ||
| 141 | - with f: | ||
| 142 | - f.write('You can safely remove this file.') | ||
| 143 | 141 | ||
| 144 | # --- ref | 142 | # --- ref |
| 145 | if 'ref' not in self: | 143 | if 'ref' not in self: |
| @@ -176,8 +174,8 @@ class TestFactory(dict): | @@ -176,8 +174,8 @@ class TestFactory(dict): | ||
| 176 | 174 | ||
| 177 | for i, q in enumerate(self['questions']): | 175 | for i, q in enumerate(self['questions']): |
| 178 | # normalize question to a dict and ref to a list of references | 176 | # normalize question to a dict and ref to a list of references |
| 179 | - if isinstance(q, str): | ||
| 180 | - q = {'ref': [q]} | 177 | + if isinstance(q, str): # e.g., - some_ref |
| 178 | + q = {'ref': [q]} # becomes - ref: [some_ref] | ||
| 181 | elif isinstance(q, dict) and isinstance(q['ref'], str): | 179 | elif isinstance(q, dict) and isinstance(q['ref'], str): |
| 182 | q['ref'] = [q['ref']] | 180 | q['ref'] = [q['ref']] |
| 183 | 181 | ||
| @@ -191,8 +189,9 @@ class TestFactory(dict): | @@ -191,8 +189,9 @@ class TestFactory(dict): | ||
| 191 | test = [] | 189 | test = [] |
| 192 | # total_points = 0.0 | 190 | # total_points = 0.0 |
| 193 | 191 | ||
| 194 | - n = 1 | ||
| 195 | - nerr = 0 | 192 | + n = 1 # track question number |
| 193 | + nerr = 0 # count errors generating questions | ||
| 194 | + | ||
| 196 | for qq in self['questions']: | 195 | for qq in self['questions']: |
| 197 | # choose one question variant | 196 | # choose one question variant |
| 198 | qref = random.choice(qq['ref']) | 197 | qref = random.choice(qq['ref']) |
| @@ -207,9 +206,9 @@ class TestFactory(dict): | @@ -207,9 +206,9 @@ class TestFactory(dict): | ||
| 207 | 206 | ||
| 208 | # some defaults | 207 | # some defaults |
| 209 | if q['type'] in ('information', 'success', 'warning', 'alert'): | 208 | if q['type'] in ('information', 'success', 'warning', 'alert'): |
| 210 | - q.setdefault('points', 0.0) | 209 | + q['points'] = qq.get('points', 0.0) |
| 211 | else: | 210 | else: |
| 212 | - q.setdefault('points', 1.0) | 211 | + q['points'] = qq.get('points', 1.0) |
| 213 | q['number'] = n # counter for non informative panels | 212 | q['number'] = n # counter for non informative panels |
| 214 | n += 1 | 213 | n += 1 |
| 215 | 214 |