Commit 53e9b6550810c44d21325e36f2e714318055de12

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

- incorporate fixes from test.py (already in master)

- update BUGS.md
.gitignore
... ... @@ -9,4 +9,7 @@ static/lib
9 9 /*.eggnode_modules
10 10  
11 11 # ignore javascript libraries installed with npm
12   -node_modules/
13 12 \ No newline at end of file
  13 +node_modules/
  14 +
  15 +# ignore documentation until it is actually written
  16 +doc/
14 17 \ No newline at end of file
... ...
BUGS.md
1 1  
2 2 # BUGS
3 3  
4   -- quando se clica no texto de uma opcao, salta para outro lado na pagina.
  4 +- codigo `hello world` nao esta a preservar o whitespace. O renderer de markdown gera a tag <code> que não preserva whitespace. Necessario adicionar <pre>.
  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 8 - ordenacao das notas em /admin nao é numerica, é ascii...
6 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 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,9 +15,11 @@ ou usar push (websockets?)
12 15 - lidar com eventos unfocus.
13 16 - servidor nao esta a lidar com eventos scroll/resize. ignorar?
14 17 - Test.reset_answers() unused.
  18 +- mudar ref do test para test_id (ref já é usado nas perguntas)
15 19  
16 20 # TODO
17 21  
  22 +- nao esta a usar points das perguntas
18 23 - test: mostrar duração do teste com progressbar no navbar.
19 24 - submissao fazer um post ajax?
20 25 - adicionar opcao para eliminar um teste em curso.
... ... @@ -54,6 +59,7 @@ ou usar push (websockets?)
54 59  
55 60 # FIXED
56 61  
  62 +- quando se clica no texto de uma opcao, salta para outro lado na pagina.
57 63 - 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 64 - fazer package para instalar perguntations com pip.
59 65 - pymips: nao pode executar syscalls do spim.
... ...
perguntations/__init__.py
... ... @@ -32,7 +32,7 @@ proof of submission and for review.
32 32 '''
33 33  
34 34 APP_NAME = 'perguntations'
35   -APP_VERSION = '2019.02.dev1'
  35 +APP_VERSION = '2019.06.dev1'
36 36 APP_DESCRIPTION = __doc__
37 37  
38 38 __author__ = 'Miguel Barão'
... ...
perguntations/test.py
... ... @@ -133,13 +133,11 @@ class TestFactory(dict):
133 133  
134 134 testfile = path.join(path.expanduser(self['answers_dir']), 'REMOVE-ME')
135 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 138 except OSError:
138 139 logger.critical(f'Can\'t write answers to "{self["answers_dir"]}"')
139 140 raise TestFactoryException()
140   - else:
141   - with f:
142   - f.write('You can safely remove this file.')
143 141  
144 142 # --- ref
145 143 if 'ref' not in self:
... ... @@ -176,8 +174,8 @@ class TestFactory(dict):
176 174  
177 175 for i, q in enumerate(self['questions']):
178 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 179 elif isinstance(q, dict) and isinstance(q['ref'], str):
182 180 q['ref'] = [q['ref']]
183 181  
... ... @@ -191,8 +189,9 @@ class TestFactory(dict):
191 189 test = []
192 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 195 for qq in self['questions']:
197 196 # choose one question variant
198 197 qref = random.choice(qq['ref'])
... ... @@ -207,9 +206,9 @@ class TestFactory(dict):
207 206  
208 207 # some defaults
209 208 if q['type'] in ('information', 'success', 'warning', 'alert'):
210   - q.setdefault('points', 0.0)
  209 + q['points'] = qq.get('points', 0.0)
211 210 else:
212   - q.setdefault('points', 1.0)
  211 + q['points'] = qq.get('points', 1.0)
213 212 q['number'] = n # counter for non informative panels
214 213 n += 1
215 214  
... ...