Commit a76eadc004315a1e23ae67e5d68554117f2e692e
Exists in
master
and in
1 other branch
Merge branch 'master' into dev
Showing
6 changed files
with
25 additions
and
20 deletions
Show diff stats
demo/questions/questions-tutorial.yaml
| @@ -288,6 +288,8 @@ | @@ -288,6 +288,8 @@ | ||
| 288 | * `lower` e `upper` convertem respectivamente para minúsculas e maiúsculas. | 288 | * `lower` e `upper` convertem respectivamente para minúsculas e maiúsculas. |
| 289 | transform: ['trim', 'lower'] | 289 | transform: ['trim', 'lower'] |
| 290 | correct: ['azul'] | 290 | correct: ['azul'] |
| 291 | + solution: | | ||
| 292 | + O céu é `azul`, pelo menos durante o dia e se estiver bom tempo... | ||
| 291 | 293 | ||
| 292 | # --------------------------------------------------------------------------- | 294 | # --------------------------------------------------------------------------- |
| 293 | - type: text-regex | 295 | - type: text-regex |
| @@ -329,6 +331,8 @@ | @@ -329,6 +331,8 @@ | ||
| 329 | situações. | 331 | situações. |
| 330 | 332 | ||
| 331 | correct: '(VERDE|[Vv]erde)' | 333 | correct: '(VERDE|[Vv]erde)' |
| 334 | + solution: | | ||
| 335 | + Deveria ter escrito `VERDE` ou `Verde` ou `verde`. | ||
| 332 | 336 | ||
| 333 | # --------------------------------------------------------------------------- | 337 | # --------------------------------------------------------------------------- |
| 334 | - type: numeric-interval | 338 | - type: numeric-interval |
perguntations/main.py
| @@ -31,7 +31,7 @@ def parse_cmdline_arguments(): | @@ -31,7 +31,7 @@ def parse_cmdline_arguments(): | ||
| 31 | 'have to be previously configured. Please read the documentation ' | 31 | 'have to be previously configured. Please read the documentation ' |
| 32 | 'included with this software before running the server.') | 32 | 'included with this software before running the server.') |
| 33 | parser.add_argument('testfile', | 33 | parser.add_argument('testfile', |
| 34 | - type=str, nargs='?', | 34 | + type=str, |
| 35 | help='tests in YAML format') | 35 | help='tests in YAML format') |
| 36 | parser.add_argument('--allow-all', | 36 | parser.add_argument('--allow-all', |
| 37 | action='store_true', | 37 | action='store_true', |
perguntations/serve.py
| @@ -492,7 +492,6 @@ class ReviewHandler(BaseHandler): | @@ -492,7 +492,6 @@ class ReviewHandler(BaseHandler): | ||
| 492 | logging.error('JSON error in "%s": %s', fname, exc) | 492 | logging.error('JSON error in "%s": %s', fname, exc) |
| 493 | raise tornado.web.HTTPError(404) # Not Found | 493 | raise tornado.web.HTTPError(404) # Not Found |
| 494 | 494 | ||
| 495 | - print(test['show_ref']) | ||
| 496 | self.render('review.html', t=test, md=md_to_html, | 495 | self.render('review.html', t=test, md=md_to_html, |
| 497 | templ=self._templates) | 496 | templ=self._templates) |
| 498 | 497 |
perguntations/templates/review-question-text.html
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | 5 | ||
| 6 | <div class="card bg-light"> | 6 | <div class="card bg-light"> |
| 7 | <div class="card-body"> | 7 | <div class="card-body"> |
| 8 | - <pre>{{ q['answer'] if q['answer'] is not None else '' }}</pre> | 8 | + <pre>{{ escape(q['answer']) if q['answer'] is not None else '' }}</pre> |
| 9 | </div> | 9 | </div> |
| 10 | </div> | 10 | </div> |
| 11 | 11 |
perguntations/templates/review-question.html
| @@ -37,31 +37,31 @@ | @@ -37,31 +37,31 @@ | ||
| 37 | <p class="text-success"> | 37 | <p class="text-success"> |
| 38 | <i class="far fa-thumbs-up fa-3x" aria-hidden="true"></i> | 38 | <i class="far fa-thumbs-up fa-3x" aria-hidden="true"></i> |
| 39 | {{ round(q['grade'] * q['points'], 2) }} | 39 | {{ round(q['grade'] * q['points'], 2) }} |
| 40 | - pontos<br> | ||
| 41 | - {{ q['comments'] }} | 40 | + pontos |
| 42 | </p> | 41 | </p> |
| 42 | + <p class="text-success">{{ q['comments'] }}</p> | ||
| 43 | {% elif q['grade'] > 0.49 %} | 43 | {% elif q['grade'] > 0.49 %} |
| 44 | <p class="text-warning"> | 44 | <p class="text-warning"> |
| 45 | <i class="fas fa-exclamation-triangle fa-3x" aria-hidden="true"></i> | 45 | <i class="fas fa-exclamation-triangle fa-3x" aria-hidden="true"></i> |
| 46 | {{ round(q['grade'] * q['points'], 2) }} | 46 | {{ round(q['grade'] * q['points'], 2) }} |
| 47 | - pontos<br> | ||
| 48 | - {{ q['comments'] }} | ||
| 49 | - {% if 'solution' in q %} | ||
| 50 | - <hr> | ||
| 51 | - {{ md('**Solução:** \n\n' + q['solution']) }} | ||
| 52 | - {% end %} | 47 | + pontos |
| 53 | </p> | 48 | </p> |
| 49 | + <p class="text-warning">{{ q['comments'] }}</p> | ||
| 50 | + {% if q.get('solution', '') %} | ||
| 51 | + <hr> | ||
| 52 | + {{ md('**Solução:** \n\n' + q['solution']) }} | ||
| 53 | + {% end %} | ||
| 54 | {% else %} | 54 | {% else %} |
| 55 | <p class="text-danger"> | 55 | <p class="text-danger"> |
| 56 | <i class="far fa-thumbs-down fa-3x" aria-hidden="true"></i> | 56 | <i class="far fa-thumbs-down fa-3x" aria-hidden="true"></i> |
| 57 | {{ round(q['grade'] * q['points'], 2) }} | 57 | {{ round(q['grade'] * q['points'], 2) }} |
| 58 | - pontos<br> | ||
| 59 | - {{ q['comments'] }} | ||
| 60 | - {% if 'solution' in q %} | ||
| 61 | - <hr> | ||
| 62 | - {{ md('**Solução:** \n\n' + q['solution']) }} | ||
| 63 | - {% end %} | 58 | + pontos |
| 64 | </p> | 59 | </p> |
| 60 | + <p class="text-danger">{{ q['comments'] }}</p> | ||
| 61 | + {% if q.get('solution', '') %} | ||
| 62 | + <hr> | ||
| 63 | + {{ md('**Solução:** \n\n' + q['solution']) }} | ||
| 64 | + {% end %} | ||
| 65 | {% end %} | 65 | {% end %} |
| 66 | 66 | ||
| 67 | {% if t['show_ref'] %} | 67 | {% if t['show_ref'] %} |
| @@ -84,7 +84,7 @@ | @@ -84,7 +84,7 @@ | ||
| 84 | </div> | 84 | </div> |
| 85 | </h5> <!-- card-header --> | 85 | </h5> <!-- card-header --> |
| 86 | 86 | ||
| 87 | - <div class="card-body text-secondary"> | 87 | + <div class="card-body text-secondary bg-light"> |
| 88 | <p id="text"> | 88 | <p id="text"> |
| 89 | {{ md(q['text']) }} | 89 | {{ md(q['text']) }} |
| 90 | </p> | 90 | </p> |
| @@ -102,7 +102,7 @@ | @@ -102,7 +102,7 @@ | ||
| 102 | <i class="fas fa-ban fa-3x" aria-hidden="true"></i> | 102 | <i class="fas fa-ban fa-3x" aria-hidden="true"></i> |
| 103 | {{ round(q['grade'] * q['points'], 2) }} pontos<br> | 103 | {{ round(q['grade'] * q['points'], 2) }} pontos<br> |
| 104 | {{ q['comments'] }} | 104 | {{ q['comments'] }} |
| 105 | - {% if 'solution' in q %} | 105 | + {% if q.get('solution', '') %} |
| 106 | <hr> | 106 | <hr> |
| 107 | {{ md('**Solução:** \n\n' + q['solution']) }} | 107 | {{ md('**Solução:** \n\n' + q['solution']) }} |
| 108 | {% end %} | 108 | {% end %} |
perguntations/templates/review.html
| @@ -75,7 +75,9 @@ | @@ -75,7 +75,9 @@ | ||
| 75 | <h5> | 75 | <h5> |
| 76 | <div class="row"> | 76 | <div class="row"> |
| 77 | <label for="duracao" class="col-sm-2">Duração (minutos):</label> | 77 | <label for="duracao" class="col-sm-2">Duração (minutos):</label> |
| 78 | - <div class="col-sm-10" id="duracao">{{ t.get('duration', chr(8734)) }}</div> | 78 | + <div class="col-sm-10" id="duracao"> |
| 79 | + {{ t.get('duration', 0) if t.get('duration', 0) > 0 else '+'+chr(8734) }} | ||
| 80 | + </div> | ||
| 79 | </div> | 81 | </div> |
| 80 | </h5> | 82 | </h5> |
| 81 | 83 |