Commit c2f89a7b819f18f38f762bdfb4acc249eb5ea4d9
1 parent
4a961828
Exists in
master
and in
1 other branch
- everything working.
Showing
7 changed files
with
34 additions
and
51 deletions
Show diff stats
BUGS.md
| 1 | 1 | ||
| 2 | # BUGS | 2 | # BUGS |
| 3 | 3 | ||
| 4 | -- reset password nao funciona no admin | ||
| 5 | - qual a diferenca entre md_to_html e md_to_html_review, parece desnecessario haver dois. | 4 | - qual a diferenca entre md_to_html e md_to_html_review, parece desnecessario haver dois. |
| 6 | - servir imagens das perguntas | 5 | - servir imagens das perguntas |
| 7 | - como alterar configuracao para mostrar logs de debug? | 6 | - como alterar configuracao para mostrar logs de debug? |
| @@ -12,6 +11,7 @@ | @@ -12,6 +11,7 @@ | ||
| 12 | 11 | ||
| 13 | # TODO | 12 | # TODO |
| 14 | 13 | ||
| 14 | +- cancelar teste no menu admin. Dado o numero de aluno remove teste e faz logout do aluno. | ||
| 15 | - decorador para user 0, evita o "if uid==0" em muitas funcoes. | 15 | - decorador para user 0, evita o "if uid==0" em muitas funcoes. |
| 16 | - mathjax-node: | 16 | - mathjax-node: |
| 17 | sudo pkg install node npm | 17 | sudo pkg install node npm |
| @@ -35,6 +35,7 @@ | @@ -35,6 +35,7 @@ | ||
| 35 | 35 | ||
| 36 | # FIXED | 36 | # FIXED |
| 37 | 37 | ||
| 38 | +- reset password nao funciona no admin | ||
| 38 | - reload a intervalos não funciona. | 39 | - reload a intervalos não funciona. |
| 39 | - allow/deny nao funciona no /admin. | 40 | - allow/deny nao funciona no /admin. |
| 40 | - Review de um teste que foi apagado rebenta. | 41 | - Review de um teste que foi apagado rebenta. |
app.py
| @@ -252,9 +252,7 @@ class App(object): | @@ -252,9 +252,7 @@ class App(object): | ||
| 252 | 'start_time': self.online.get(uid, {}).get('test', {}).get('start_time',''), | 252 | 'start_time': self.online.get(uid, {}).get('test', {}).get('start_time',''), |
| 253 | 'password_defined': pw != '', | 253 | 'password_defined': pw != '', |
| 254 | 'grades': self.get_student_grades_from_test(uid, self.testfactory['ref']), | 254 | 'grades': self.get_student_grades_from_test(uid, self.testfactory['ref']), |
| 255 | - 'ip_address': self.online.get(uid, {}).get('student', {}).get('ip_address',''), | ||
| 256 | - 'user_agent': self.online.get(uid, {}).get('student', {}).get('user_agent',''), | ||
| 257 | - 'focus': self.online.get(uid, {}).get('student', {}).get('focus', True), | 255 | + 'focus': self.online.get(uid, {}).get('student', {}).get('focus', True), # FIXME |
| 258 | }) | 256 | }) |
| 259 | return l | 257 | return l |
| 260 | 258 | ||
| @@ -284,11 +282,11 @@ class App(object): | @@ -284,11 +282,11 @@ class App(object): | ||
| 284 | s.commit() | 282 | s.commit() |
| 285 | logger.info(f'Student {uid}: password reset to ""') | 283 | logger.info(f'Student {uid}: password reset to ""') |
| 286 | 284 | ||
| 287 | - def set_user_agent(self, uid, user_agent=''): | ||
| 288 | - self.online[uid]['student']['user_agent'] = user_agent | 285 | + # def set_user_agent(self, uid, user_agent=''): |
| 286 | + # self.online[uid]['student']['user_agent'] = user_agent | ||
| 289 | 287 | ||
| 290 | - def set_user_ip(self, uid, ipaddress=''): | ||
| 291 | - self.online[uid]['student']['ip_address'] = ipaddress | 288 | + # def set_user_ip(self, uid, ipaddress=''): |
| 289 | + # self.online[uid]['student']['ip_address'] = ipaddress | ||
| 292 | 290 | ||
| 293 | def insert_new_student(self, uid, name): | 291 | def insert_new_student(self, uid, name): |
| 294 | try: | 292 | try: |
serve.py
| @@ -280,7 +280,6 @@ class AdminHandler(BaseHandler): | @@ -280,7 +280,6 @@ class AdminHandler(BaseHandler): | ||
| 280 | self.testapp.deny_student(value) | 280 | self.testapp.deny_student(value) |
| 281 | 281 | ||
| 282 | elif cmd == 'reset_password': | 282 | elif cmd == 'reset_password': |
| 283 | - print('reset ',value) | ||
| 284 | self.testapp.reset_password(value) | 283 | self.testapp.reset_password(value) |
| 285 | 284 | ||
| 286 | elif cmd == 'insert_student': | 285 | elif cmd == 'insert_student': |
static/css/test.css
| 1 | /* Fixes navigation panel overlaying content */ | 1 | /* Fixes navigation panel overlaying content */ |
| 2 | html { | 2 | html { |
| 3 | - font-size: 14px; | 3 | + font-size: 13px; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | body { | 6 | body { |
| @@ -14,20 +14,15 @@ body { | @@ -14,20 +14,15 @@ body { | ||
| 14 | color: inherit; | 14 | color: inherit; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | -/*.card { | 17 | +.card { |
| 18 | margin-top: 70px; | 18 | margin-top: 70px; |
| 19 | } | 19 | } |
| 20 | -*/ | ||
| 21 | 20 | ||
| 22 | -/*.drop-shadow { | ||
| 23 | - -webkit-box-shadow: 0 0 5px 2px rgba(0, 0, 0, .5); | ||
| 24 | - box-shadow: 0px 2px 10px 3px rgba(0, 0, 0, .2); | ||
| 25 | - border-radius:5px; | ||
| 26 | -} | ||
| 27 | -*/ | 21 | + |
| 28 | textarea { | 22 | textarea { |
| 29 | font-family: monospace !important; | 23 | font-family: monospace !important; |
| 30 | } | 24 | } |
| 25 | + | ||
| 31 | /* make markdown tables beautiful */ | 26 | /* make markdown tables beautiful */ |
| 32 | table { | 27 | table { |
| 33 | border-collapse: collapse; | 28 | border-collapse: collapse; |
static/js/admin.js
| 1 | $(document).ready(function() { | 1 | $(document).ready(function() { |
| 2 | - // button handlers (runs once) | ||
| 3 | function button_handlers() { | 2 | function button_handlers() { |
| 4 | - | 3 | + // button handlers (runs once) |
| 5 | $("#allow_all").click( | 4 | $("#allow_all").click( |
| 6 | function() { | 5 | function() { |
| 7 | $(":checkbox").prop("checked", true).trigger('change'); | 6 | $(":checkbox").prop("checked", true).trigger('change'); |
| @@ -39,7 +38,6 @@ $(document).ready(function() { | @@ -39,7 +38,6 @@ $(document).ready(function() { | ||
| 39 | }); | 38 | }); |
| 40 | } | 39 | } |
| 41 | ); | 40 | ); |
| 42 | - | ||
| 43 | // authorization checkboxes in the students_table: | 41 | // authorization checkboxes in the students_table: |
| 44 | $("tbody", "#students_table").on("change", "input", autorizeStudent); | 42 | $("tbody", "#students_table").on("change", "input", autorizeStudent); |
| 45 | } | 43 | } |
| @@ -86,7 +84,7 @@ $(document).ready(function() { | @@ -86,7 +84,7 @@ $(document).ready(function() { | ||
| 86 | $.ajax({ | 84 | $.ajax({ |
| 87 | url: "/admin", | 85 | url: "/admin", |
| 88 | data: {"cmd": "test", "value": ""}, | 86 | data: {"cmd": "test", "value": ""}, |
| 89 | - // dataType: "json", | 87 | + dataType: "json", |
| 90 | success: function(data) { | 88 | success: function(data) { |
| 91 | // fill jumbotron data | 89 | // fill jumbotron data |
| 92 | $("#title").html(data['data']['title']); | 90 | $("#title").html(data['data']['title']); |
| @@ -114,8 +112,9 @@ $(document).ready(function() { | @@ -114,8 +112,9 @@ $(document).ready(function() { | ||
| 114 | emptyTable: "Não há alunos inscritos", | 112 | emptyTable: "Não há alunos inscritos", |
| 115 | }, | 113 | }, |
| 116 | ajax: { | 114 | ajax: { |
| 117 | - data: {"cmd": "students_table", "value": ""}, | ||
| 118 | url: "admin", // students_table | 115 | url: "admin", // students_table |
| 116 | + data: {"cmd": "students_table", "value": ""}, | ||
| 117 | + dataType: "json", | ||
| 119 | dataSrc: function ( json ) { | 118 | dataSrc: function ( json ) { |
| 120 | var t = []; | 119 | var t = []; |
| 121 | for ( var i=0; i<json.data.length ; i++ ) { | 120 | for ( var i=0; i<json.data.length ; i++ ) { |
| @@ -145,7 +144,7 @@ $(document).ready(function() { | @@ -145,7 +144,7 @@ $(document).ready(function() { | ||
| 145 | }, 3000 ); | 144 | }, 3000 ); |
| 146 | } | 145 | } |
| 147 | 146 | ||
| 148 | - // populateHeader(); // run once when the page is loaded | 147 | + populateHeader(); // run once when the page is loaded |
| 149 | populateStudentsTable(); | 148 | populateStudentsTable(); |
| 150 | button_handlers(); // assign handlers to buttons | 149 | button_handlers(); // assign handlers to buttons |
| 151 | }); | 150 | }); |
templates/admin.html
| @@ -43,7 +43,7 @@ | @@ -43,7 +43,7 @@ | ||
| 43 | </a> | 43 | </a> |
| 44 | <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownAluno"> | 44 | <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownAluno"> |
| 45 | <a class="dropdown-item" href="#" id="novo_aluno" data-toggle="modal" data-target="#novo_aluno_modal">Inserir novo...</a> | 45 | <a class="dropdown-item" href="#" id="novo_aluno" data-toggle="modal" data-target="#novo_aluno_modal">Inserir novo...</a> |
| 46 | - <a class="dropdown-item" href="#" id="reset_password" data-toggle="modal" data-target="#reset_password_modal">Reset password...</a> | 46 | + <a class="dropdown-item" href="#" id="reset_password_menu" data-toggle="modal" data-target="#reset_password_modal">Reset password...</a> |
| 47 | <a class="dropdown-item" href="#" id="allow_all">Autorizar todos</a> | 47 | <a class="dropdown-item" href="#" id="allow_all">Autorizar todos</a> |
| 48 | <a class="dropdown-item" href="#" id="deny_all">Desautorizar todos</a> | 48 | <a class="dropdown-item" href="#" id="deny_all">Desautorizar todos</a> |
| 49 | </div> | 49 | </div> |
| @@ -105,7 +105,6 @@ | @@ -105,7 +105,6 @@ | ||
| 105 | </div> | 105 | </div> |
| 106 | 106 | ||
| 107 | <div class="modal-footer"> | 107 | <div class="modal-footer"> |
| 108 | - <!-- <button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button> --> | ||
| 109 | <button id="inserir_novo_aluno" class="btn btn-primary" role="button" data-dismiss="modal">Inserir</button> | 108 | <button id="inserir_novo_aluno" class="btn btn-primary" role="button" data-dismiss="modal">Inserir</button> |
| 110 | </div> | 109 | </div> |
| 111 | 110 | ||
| @@ -124,15 +123,20 @@ | @@ -124,15 +123,20 @@ | ||
| 124 | </div> | 123 | </div> |
| 125 | 124 | ||
| 126 | <div class="modal-body"> | 125 | <div class="modal-body"> |
| 127 | - <div class="input-group input-group-sm"> | ||
| 128 | - <input id="reset_number" type="text" class="form-control" placeholder="Número"> | ||
| 129 | - <span class="input-group-btn"> | ||
| 130 | - <button id="reset_password" class="btn btn-primary" type="button">Reset password!</button> | ||
| 131 | - </span> | 126 | + <div class="form-group row"> |
| 127 | + <label for="reset_number" class="col-sm-2 col-form-label">Número</label> | ||
| 128 | + <div class="col-sm-10"> | ||
| 129 | + <input id="reset_number" type="text" class="form-control"> | ||
| 130 | + <!-- <input type="text" class="form-control" id="novo_numero" value=""> --> | ||
| 131 | + </div> | ||
| 132 | </div> | 132 | </div> |
| 133 | </div> | 133 | </div> |
| 134 | + | ||
| 135 | + <div class="modal-footer"> | ||
| 136 | + <button id="reset_password" class="btn btn-primary" role="button" data-dismiss="modal">Reset password</button> | ||
| 137 | + </div> | ||
| 134 | </div> | 138 | </div> |
| 135 | - </div> | 139 | + </div> <!-- modal --> |
| 136 | </div> | 140 | </div> |
| 137 | 141 | ||
| 138 | 142 |
templates/test.html
| @@ -42,22 +42,10 @@ | @@ -42,22 +42,10 @@ | ||
| 42 | </ul> | 42 | </ul> |
| 43 | 43 | ||
| 44 | <span class="navbar-text"> | 44 | <span class="navbar-text"> |
| 45 | - | ||
| 46 | - | ||
| 47 | -<!-- <span class="navbar-text dropdown"> | ||
| 48 | - <a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | ||
| 49 | - --> | ||
| 50 | - | ||
| 51 | <i class="fa fa-user" aria-hidden="true"></i> | 45 | <i class="fa fa-user" aria-hidden="true"></i> |
| 52 | <span id="name">{{ escape(t['student']['name']) }}</span> | 46 | <span id="name">{{ escape(t['student']['name']) }}</span> |
| 53 | (<span id="number">{{ escape(t['student']['number']) }}</span>) | 47 | (<span id="number">{{ escape(t['student']['number']) }}</span>) |
| 54 | <span class="caret"></span> | 48 | <span class="caret"></span> |
| 55 | - | ||
| 56 | -<!-- </a> | ||
| 57 | - <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink"> | ||
| 58 | - <a class="dropdown-item" href="#">Password</a> | ||
| 59 | - </div> | ||
| 60 | - --> | ||
| 61 | </span> | 49 | </span> |
| 62 | </div> | 50 | </div> |
| 63 | </nav> | 51 | </nav> |
| @@ -65,17 +53,16 @@ | @@ -65,17 +53,16 @@ | ||
| 65 | 53 | ||
| 66 | <div class="jumbotron"> | 54 | <div class="jumbotron"> |
| 67 | <h1 class="display-5">{{ t['title'] }}</h1> | 55 | <h1 class="display-5">{{ t['title'] }}</h1> |
| 68 | - {{ t.get('duration', '') }} | ||
| 69 | <hr> | 56 | <hr> |
| 70 | 57 | ||
| 71 | <h5> | 58 | <h5> |
| 72 | <div class="row"> | 59 | <div class="row"> |
| 73 | - <label for="inicio" class="col-sm-2">Início:</label> | ||
| 74 | - <div class="col-sm-10" id="inicio">{{ str(t['start_time'].time())[:8]}}</div> | 60 | + <label for="inicio" class="col-sm-3">Início:</label> |
| 61 | + <div class="col-sm-9" id="inicio">{{ str(t['start_time'].time())[:8]}}</div> | ||
| 75 | </div> | 62 | </div> |
| 76 | <div class="row"> | 63 | <div class="row"> |
| 77 | - <label for="duracao" class="col-sm-2">Duração:</label> | ||
| 78 | - <div class="col-sm-10" id="duracao">{{ t.get('duration', chr(8734)) }}</div> | 64 | + <label for="duracao" class="col-sm-3">Duração:</label> |
| 65 | + <div class="col-sm-9" id="duracao">{{ t.get('duration', chr(8734)) }}</div> | ||
| 79 | </div> | 66 | </div> |
| 80 | </h5> | 67 | </h5> |
| 81 | </div> | 68 | </div> |
| @@ -86,10 +73,10 @@ | @@ -86,10 +73,10 @@ | ||
| 86 | {% end %} | 73 | {% end %} |
| 87 | 74 | ||
| 88 | <div class="form-row"> | 75 | <div class="form-row"> |
| 89 | - <div class="col-9"> | 76 | + <div class="col-12"> |
| 90 | <button type="button" class="btn btn-success btn-lg btn-block" data-toggle="modal" data-target="#confirmar" id="form-button-submit">Submeter teste</button> | 77 | <button type="button" class="btn btn-success btn-lg btn-block" data-toggle="modal" data-target="#confirmar" id="form-button-submit">Submeter teste</button> |
| 91 | </div> | 78 | </div> |
| 92 | -<!-- <div class="col-3"> | 79 | +<!-- <div class="col-2"> |
| 93 | <button type="button" class="btn btn-danger btn-lg btn-block" data-toggle="modal" data-target="#sair" id="form-button-sair">Desisto</button> | 80 | <button type="button" class="btn btn-danger btn-lg btn-block" data-toggle="modal" data-target="#sair" id="form-button-sair">Desisto</button> |
| 94 | </div> --> | 81 | </div> --> |
| 95 | </div> | 82 | </div> |