Commit 2f37bba0126c947c154deb053f422b51f08f37df
1 parent
1456371e
Exists in
master
and in
1 other branch
- remember previous radio e checkbox answers in practice mode.
Showing
2 changed files
with
6 additions
and
5 deletions
Show diff stats
questions.py
@@ -381,7 +381,8 @@ class QuestionTextArea(Question): | @@ -381,7 +381,8 @@ class QuestionTextArea(Question): | ||
381 | except subprocess.TimeoutExpired: | 381 | except subprocess.TimeoutExpired: |
382 | p.kill() | 382 | p.kill() |
383 | # p.communicate() # FIXME parece que este communicate obriga a ficar ate ao final do processo, mas nao consigo repetir o comportamento num script simples... | 383 | # p.communicate() # FIXME parece que este communicate obriga a ficar ate ao final do processo, mas nao consigo repetir o comportamento num script simples... |
384 | - self['grade'] = 0.0 # student gets a zero if timout occurs | 384 | + value = 0.0 # student gets a zero if timout occurs |
385 | + printf(' * Timeout in correction script') | ||
385 | 386 | ||
386 | # In case the correction program returns a non float value, we assume an error | 387 | # In case the correction program returns a non float value, we assume an error |
387 | # has occurred (for instance, invalid input). We just assume its the student's | 388 | # has occurred (for instance, invalid input). We just assume its the student's |
templates/test.html
@@ -162,7 +162,7 @@ | @@ -162,7 +162,7 @@ | ||
162 | % for opt in q['options']: | 162 | % for opt in q['options']: |
163 | <div class="radio"> | 163 | <div class="radio"> |
164 | <label class="option"> | 164 | <label class="option"> |
165 | - <input type="radio" name="${q['ref']}" id="${q['ref']}${loop.index}" value="${loop.index}"> | 165 | + <input type="radio" name="${q['ref']}" id="${q['ref']}${loop.index}" value="${loop.index}" ${'checked' if q['answer'] is not None and str(loop.index) == q['answer'] else ''}> |
166 | ${pretty(opt)} | 166 | ${pretty(opt)} |
167 | </label> | 167 | </label> |
168 | </div> | 168 | </div> |
@@ -172,7 +172,7 @@ | @@ -172,7 +172,7 @@ | ||
172 | % for opt in q['options']: | 172 | % for opt in q['options']: |
173 | <div class="checkbox"> | 173 | <div class="checkbox"> |
174 | <label> | 174 | <label> |
175 | - <input type="checkbox" name="${q['ref']}" id="${q['ref']}${loop.index}" value="${loop.index}"> | 175 | + <input type="checkbox" name="${q['ref']}" id="${q['ref']}${loop.index}" value="${loop.index}" ${'checked' if q['answer'] is not None and str(loop.index) in q['answer'] else ''}> |
176 | ${pretty(opt)} | 176 | ${pretty(opt)} |
177 | </label> | 177 | </label> |
178 | </div> | 178 | </div> |
@@ -231,11 +231,11 @@ | @@ -231,11 +231,11 @@ | ||
231 | </div> | 231 | </div> |
232 | % else: | 232 | % else: |
233 | <div class="alert alert-danger" role="alert"> | 233 | <div class="alert alert-danger" role="alert"> |
234 | - <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> | ||
235 | - ${round(q['grade'] * q['points'] / total_points * 20.0, 1)} pontos | ||
236 | <p> | 234 | <p> |
237 | ${random.choice(t['offensive']) if 'offensive' in t else ''} | 235 | ${random.choice(t['offensive']) if 'offensive' in t else ''} |
238 | </p> | 236 | </p> |
237 | + <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> | ||
238 | + ${round(q['grade'] * q['points'] / total_points * 20.0, 1)} pontos | ||
239 | </div> | 239 | </div> |
240 | % endif | 240 | % endif |
241 | % endif | 241 | % endif |