Commit 74a38303ebbdfc7abe428e3e70df4f5e4946dfa0
1 parent
9db32bd0
Exists in
master
and in
1 other branch
- show type of submission
- fix timer when there is no time limit
Showing
3 changed files
with
17 additions
and
6 deletions
Show diff stats
demo/demo.yaml
| @@ -22,7 +22,7 @@ title: Teste de demonstração (tutorial) | @@ -22,7 +22,7 @@ title: Teste de demonstração (tutorial) | ||
| 22 | # Duration in minutes. | 22 | # Duration in minutes. |
| 23 | # (0 or undefined means infinite time) | 23 | # (0 or undefined means infinite time) |
| 24 | duration: 10 | 24 | duration: 10 |
| 25 | -autosubmit: false | 25 | +autosubmit: true |
| 26 | 26 | ||
| 27 | # Show points for each question, scale 0-20. | 27 | # Show points for each question, scale 0-20. |
| 28 | # (default: false) | 28 | # (default: false) |
perguntations/__init__.py
| @@ -32,7 +32,7 @@ proof of submission and for review. | @@ -32,7 +32,7 @@ proof of submission and for review. | ||
| 32 | ''' | 32 | ''' |
| 33 | 33 | ||
| 34 | APP_NAME = 'perguntations' | 34 | APP_NAME = 'perguntations' |
| 35 | -APP_VERSION = '2020.03.dev1' | 35 | +APP_VERSION = '2020.04.dev1' |
| 36 | APP_DESCRIPTION = __doc__ | 36 | APP_DESCRIPTION = __doc__ |
| 37 | 37 | ||
| 38 | __author__ = 'Miguel Barão' | 38 | __author__ = 'Miguel Barão' |
perguntations/templates/test.html
| @@ -91,7 +91,11 @@ | @@ -91,7 +91,11 @@ | ||
| 91 | </div> | 91 | </div> |
| 92 | <div class="row"> | 92 | <div class="row"> |
| 93 | <label for="duracao" class="col-sm-3">Duração:</label> | 93 | <label for="duracao" class="col-sm-3">Duração:</label> |
| 94 | - <div class="col-sm-9" id="duracao">{{ str(t['duration'])+' minutos' if t['duration'] > 0 else chr(8734) }}</div> | 94 | + <div class="col-sm-9" id="duracao">{{ str(t['duration'])+' minutos' if t['duration'] > 0 else 'sem limite' }}</div> |
| 95 | + </div> | ||
| 96 | + <div class="row"> | ||
| 97 | + <label for="submissao" class="col-sm-3">Submissão:</label> | ||
| 98 | + <div class="col-sm-9" id="submissao">{{ 'automática' if t['autosubmit'] else 'manual' }}</div> | ||
| 95 | </div> | 99 | </div> |
| 96 | </h5> | 100 | </h5> |
| 97 | </div> | 101 | </div> |
| @@ -147,9 +151,14 @@ | @@ -147,9 +151,14 @@ | ||
| 147 | </script> | 151 | </script> |
| 148 | 152 | ||
| 149 | <script> | 153 | <script> |
| 150 | - | ||
| 151 | var finishtime = new Date().getTime() + {{ t['duration']*60*1000 }}; | 154 | var finishtime = new Date().getTime() + {{ t['duration']*60*1000 }}; |
| 152 | 155 | ||
| 156 | + {% if t['duration'] == 0 %} | ||
| 157 | + $("#clock").html("+\u221e"); | ||
| 158 | + {% else %} | ||
| 159 | + | ||
| 160 | + | ||
| 161 | + | ||
| 153 | // Update the count down every 1 second | 162 | // Update the count down every 1 second |
| 154 | var x = setInterval(function() { | 163 | var x = setInterval(function() { |
| 155 | var now = new Date().getTime(); | 164 | var now = new Date().getTime(); |
| @@ -159,8 +168,8 @@ | @@ -159,8 +168,8 @@ | ||
| 159 | var minutes = Math.floor((distance / (1000 * 60))); | 168 | var minutes = Math.floor((distance / (1000 * 60))); |
| 160 | var seconds = Math.floor((distance % (1000 * 60)) / 1000); | 169 | var seconds = Math.floor((distance % (1000 * 60)) / 1000); |
| 161 | 170 | ||
| 162 | - if (distance >= 1000*50) { | ||
| 163 | - $("#clock").html(minutes + ":" + seconds); | 171 | + if (distance >= 1000*60) { |
| 172 | + $("#clock").html(minutes + ":" + (seconds<10?'0':'') +seconds); | ||
| 164 | } | 173 | } |
| 165 | else if (distance >= 0) { | 174 | else if (distance >= 0) { |
| 166 | $("#navbar").removeClass('bg-dark').addClass("bg-danger"); | 175 | $("#navbar").removeClass('bg-dark').addClass("bg-danger"); |
| @@ -174,6 +183,8 @@ | @@ -174,6 +183,8 @@ | ||
| 174 | } | 183 | } |
| 175 | }, 1000); | 184 | }, 1000); |
| 176 | 185 | ||
| 186 | + {% end %} | ||
| 187 | + | ||
| 177 | </script> | 188 | </script> |
| 178 | 189 | ||
| 179 | 190 |