Commit 094837eb454f6de44a4b11a555ae1c1a1cea0fef

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

- progress bar under the menu shows the remaining time.

- update BUGS.md
- add example of random choice of questions in demo.yaml
- update .gitignore
- remove package-lock.json from git repository
BUGS.md
... ... @@ -5,7 +5,6 @@
5 5 - servidor ntpd para configurar a data/hora dos portateis dell
6 6 - link na pagina com a nota para voltar ao principio.
7 7 - CRITICAL se answer for `i<n` a revisão de provas mostra apenas i (interpreta `<` como tag?)
8   -- sock.bind(sockaddr) OSError: [Errno 48] Address already in use
9 8 - na pagina grade.html as barras estao normalizadas para os limites scale_min e max do teste actual e nao do realizado.
10 9 - 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>.
11 10 - teste nao esta a mostrar imagens de vez em quando.
... ... @@ -16,15 +15,14 @@
16 15 - melhorar o botao de autorizar (desliga-se), usar antes um botao?
17 16 e.g. retornar None quando nao ha alteracoes relativamente à última vez.
18 17 ou usar push (websockets?)
19   -- lidar com eventos unfocus.
20   -- servidor nao esta a lidar com eventos scroll/resize. ignorar?
21 18 - Test.reset_answers() unused.
22 19 - mudar ref do test para test_id (ref já é usado nas perguntas)
23 20 - incluir test_id na tabela questions (futuro semestre, pode quebrar compatibilidade).
24   -- na pagina admin, mostrar com cor vermelha as horas de entrada dos alunos que ja tenha excedido o tempo
  21 +- na pagina admin, mostrar com cor vermelha as horas de entrada dos alunos que ja tenham excedido o tempo
25 22  
26 23 # TODO
27 24  
  25 +- mostrar unfocus e window area em /admin
28 26 - testar as perguntas todas no início do teste.
29 27 - test: mostrar duração do teste com progressbar no navbar.
30 28 - submissao fazer um post ajax?
... ... @@ -65,6 +63,9 @@ ou usar push (websockets?)
65 63  
66 64 # FIXED
67 65  
  66 +- lidar com eventos unfocus.
  67 +- servidor nao esta a lidar com eventos resize.
  68 +- sock.bind(sockaddr) OSError: [Errno 48] Address already in use
68 69 - dizer quanto desconta em cada pergunta de escolha multipla
69 70 - se houver erros a abrir ficheiros .yaml de perguntas, depois dos testes diz "No errors found".
70 71 - se faltarem files na especificação do teste, o check não detecta e factory não gera para essas perguntas.
... ...
demo/demo.yaml
... ... @@ -64,9 +64,10 @@ questions:
64 64 - tut-information
65 65 - tut-success
66 66 - tut-warning
67   - - tut-alert
  67 + - [tut-alert1, tut-alert2]
68 68 - tut-generator
69 69  
  70 +
70 71 # test:
71 72 # - ref1
72 73 # - block: a
... ...
demo/questions/questions-tutorial.yaml
... ... @@ -535,8 +535,24 @@
535 535  
536 536 # ----------------------------------------------------------------------------
537 537 - type: alert
538   - ref: tut-alert
539   - title: Texto informativo (perigo)
  538 + ref: tut-alert1
  539 + title: Texto informativo (perigo) - versão 1
  540 + text: |
  541 + Não conta para avaliação. Texto importante.
  542 +
  543 + ![planetas](planets.png "Planetas do Sistema Solar")
  544 +
  545 + As imagens podem ser adicionadas usando a notação standard em markdown. Há
  546 + duas possibilidads:
  547 +
  548 + - Imagens inline: não têm título definido e podem ser incluídas no meio de
  549 + uma linha de texto usando`![alt text](image.jpg)`.
  550 + - Imagens centradas com título: `![alt text](image.jpg "Título da imagem")`.
  551 + O título aprece por baixo da imagem. O título pode ser uma string vazia.
  552 +
  553 +- type: alert
  554 + ref: tut-alert2
  555 + title: Texto informativo (perigo) - versão 2
540 556 text: |
541 557 Não conta para avaliação. Texto importante.
542 558  
... ... @@ -555,7 +571,7 @@
555 571 text: |
556 572 This question is not included in the test and will not shown up.
557 573 It also lacks a "ref" and is automatically named
558   - `questions/questions-tutorial.yaml:0012`.
  574 + `questions/questions-tutorial.yaml:0013`.
559 575 A warning is shown on the console about this.
560 576 The number at the end is the index position of this question.
561 577 Indices start at 0.
... ...
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 = '2020.04.dev4'
  35 +APP_VERSION = '2020.04.dev5'
36 36 APP_DESCRIPTION = __doc__
37 37  
38 38 __author__ = 'Miguel Barão'
... ...
perguntations/templates/test.html
... ... @@ -44,8 +44,12 @@
44 44 <!-- ===================================================================== -->
45 45 <body>
46 46 <!-- ===================================================================== -->
  47 +<div class="progress fixed-top" style="height: 60px; border-radius: 0px;">
  48 + <div class="progress-bar bg-secondary" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
  49 +</div>
47 50  
48 51 <nav id="navbar" class="navbar navbar-expand-sm fixed-top navbar-dark bg-dark">
  52 +
49 53 <a class="navbar-brand" href="#">
50 54 <img src="/static/logo_horizontal.png" height="30" alt="">
51 55 </a>
... ... @@ -62,6 +66,7 @@
62 66 <li class="nav-item"><h5>
63 67 <span class="navbar-text" id="clock"> --:-- </span>
64 68 </h5>
  69 +
65 70 </li>
66 71 </ul>
67 72  
... ... @@ -76,6 +81,7 @@
76 81 </li>
77 82 </ul>
78 83 </div>
  84 +
79 85 </nav>
80 86  
81 87 <!-- ===================================================================== -->
... ... @@ -152,7 +158,8 @@
152 158 </script>
153 159  
154 160 <script>
155   - var finishtime = new Date().getTime() + {{ t['duration']*60*1000 }};
  161 + var duration = {{ t['duration']*60*1000 }}; // ms
  162 + var finishtime = new Date().getTime() + duration;
156 163  
157 164 {% if t['duration'] == 0 %}
158 165 $("#clock").html("+\u221e");
... ... @@ -161,7 +168,7 @@
161 168 // Update the count down every 1 second
162 169 var x = setInterval(function() {
163 170 var now = new Date().getTime();
164   - var distance = finishtime - now;
  171 + var distance = finishtime - now; // ms
165 172  
166 173 // Time calculations for days, hours, minutes and seconds
167 174 var minutes = Math.floor((distance / (1000 * 60)));
... ... @@ -180,6 +187,9 @@
180 187 $("#test").submit();
181 188 {% end %}
182 189 }
  190 +
  191 + var progress = distance/duration*100 + '%'
  192 + $('.progress-bar').css('width', progress).attr('aria-valuenow', progress);
183 193 }, 1000);
184 194  
185 195 {% end %}
... ...