Commit 9bace4f61e90e4a873efed7b94f7fa445be9f7ee
1 parent
16b8fb45
Exists in
master
and in
1 other branch
- show message instead of empty table in /results
Showing
1 changed file
with
70 additions
and
65 deletions
Show diff stats
templates/results.html
@@ -66,76 +66,81 @@ | @@ -66,76 +66,81 @@ | ||
66 | ${t['title']} | 66 | ${t['title']} |
67 | </div> | 67 | </div> |
68 | <!-- <div class="panel-body"> --> | 68 | <!-- <div class="panel-body"> --> |
69 | - <table class="table table-hover"> | ||
70 | - <thead> | ||
71 | - <tr> | ||
72 | - <th class="col-md-1 text-center">#</th> | ||
73 | - <th class="col-md-7 text-left">Nome</th> | ||
74 | - <th class="col-md-4 text-center">Nota</th> | ||
75 | - <th class="col-md-0"></th> | ||
76 | - </tr> | ||
77 | - </thead> | ||
78 | - <tbody> | ||
79 | - <%! | ||
80 | - from datetime import datetime | ||
81 | - %> | ||
82 | - % for r in results: | 69 | + % if not results: |
70 | + <h4 class="text-center">Ainda não há resultados</h4> | ||
71 | + | ||
72 | + % else: | ||
73 | + <table class="table table-hover"> | ||
74 | + <thead> | ||
83 | <tr> | 75 | <tr> |
84 | - <td class="text-center"> | ||
85 | - % if loop.index == 0: | ||
86 | - <h4> | ||
87 | - <!-- <span class="label label-primary"> --> | ||
88 | - 1º | ||
89 | - <!-- </span> --> | ||
90 | - </h4> | ||
91 | - % else: | ||
92 | - <!-- <span class="label label-primary"> --> | ||
93 | - ${loop.index+1} | ||
94 | - <!-- </span> --> | ||
95 | - % endif | ||
96 | - </td> | ||
97 | - <!-- <td>${r[0]}</td> --> <!-- numero --> | ||
98 | - <td> | ||
99 | - % if loop.index == 0: | ||
100 | - <h4 class="text-uppercase"><img src="\crown.jpg" /> ${r[1]}</h4> | ||
101 | - % else: | ||
102 | - ${r[1]} | ||
103 | - % endif | ||
104 | - </td> <!-- nome --> | ||
105 | - <td> <!-- nota --> | ||
106 | - <div class="progress"> | ||
107 | - % if r[2] < 10: | ||
108 | - <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="${'{0}'.format(round(r[2]))}" aria-valuemin="0" aria-valuemax="20" style="min-width: 2em; width: ${'{0}'.format(round(5 * r[2]))}%;"> | ||
109 | - % elif r[2] < 15: | ||
110 | - <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="${'{0}'.format(round(r[2]))}" aria-valuemin="0" aria-valuemax="20" style="min-width: 2em; width: ${'{0}'.format(round(5 * r[2]))}%;"> | 76 | + <th class="col-md-1 text-center">#</th> |
77 | + <th class="col-md-7 text-left">Nome</th> | ||
78 | + <th class="col-md-4 text-center">Nota</th> | ||
79 | + <th class="col-md-0"></th> | ||
80 | + </tr> | ||
81 | + </thead> | ||
82 | + <tbody> | ||
83 | + <%! | ||
84 | + from datetime import datetime | ||
85 | + %> | ||
86 | + % for r in results: | ||
87 | + <tr> | ||
88 | + <td class="text-center"> | ||
89 | + % if loop.index == 0: | ||
90 | + <h4> | ||
91 | + <!-- <span class="label label-primary"> --> | ||
92 | + 1º | ||
93 | + <!-- </span> --> | ||
94 | + </h4> | ||
95 | + % else: | ||
96 | + <!-- <span class="label label-primary"> --> | ||
97 | + ${loop.index+1} | ||
98 | + <!-- </span> --> | ||
99 | + % endif | ||
100 | + </td> | ||
101 | + <!-- <td>${r[0]}</td> --> <!-- numero --> | ||
102 | + <td> | ||
103 | + % if loop.index == 0: | ||
104 | + <h4 class="text-uppercase"><img src="\crown.jpg" /> ${r[1]}</h4> | ||
111 | % else: | 105 | % else: |
112 | - <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="${'{0}'.format(round(r[2]))}" aria-valuemin="0" aria-valuemax="20" style="min-width: 2em; width: ${'{0}'.format(round(5 * r[2]))}%;"> | 106 | + ${r[1]} |
113 | % endif | 107 | % endif |
114 | - ${'{:.1f}'.format(r[2])} | 108 | + </td> <!-- nome --> |
109 | + <td> <!-- nota --> | ||
110 | + <div class="progress"> | ||
111 | + % if r[2] < 10: | ||
112 | + <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="${'{0}'.format(round(r[2]))}" aria-valuemin="0" aria-valuemax="20" style="min-width: 2em; width: ${'{0}'.format(round(5 * r[2]))}%;"> | ||
113 | + % elif r[2] < 15: | ||
114 | + <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="${'{0}'.format(round(r[2]))}" aria-valuemin="0" aria-valuemax="20" style="min-width: 2em; width: ${'{0}'.format(round(5 * r[2]))}%;"> | ||
115 | + % else: | ||
116 | + <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="${'{0}'.format(round(r[2]))}" aria-valuemin="0" aria-valuemax="20" style="min-width: 2em; width: ${'{0}'.format(round(5 * r[2]))}%;"> | ||
117 | + % endif | ||
118 | + ${'{:.1f}'.format(r[2])} | ||
119 | + </div> | ||
115 | </div> | 120 | </div> |
116 | - </div> | ||
117 | - </td> | ||
118 | - <td class="text-right"> | ||
119 | - <% | ||
120 | - dt = datetime.now() - datetime.strptime(r[3], '%Y-%m-%d %H:%M:%S.%f') | ||
121 | - %> | ||
122 | - <small> | ||
123 | - % if dt.days > 0: | ||
124 | - ${dt.days}d | ||
125 | - % elif dt.seconds >= 3600: | ||
126 | - (${dt.seconds // 3600} horas | ||
127 | - % elif dt.seconds >= 60: | ||
128 | - (${dt.seconds // 60} minutos | ||
129 | - % else: | ||
130 | - (${dt.seconds} segundos | ||
131 | - % endif | 121 | + </td> |
122 | + <td class="text-right"> | ||
123 | + <% | ||
124 | + dt = datetime.now() - datetime.strptime(r[3], '%Y-%m-%d %H:%M:%S.%f') | ||
125 | + %> | ||
126 | + <small> | ||
127 | + % if dt.days > 0: | ||
128 | + ${dt.days}d | ||
129 | + % elif dt.seconds >= 3600: | ||
130 | + (${dt.seconds // 3600} horas | ||
131 | + % elif dt.seconds >= 60: | ||
132 | + (${dt.seconds // 60} minutos | ||
133 | + % else: | ||
134 | + (${dt.seconds} segundos | ||
135 | + % endif | ||
132 | 136 | ||
133 | - </small> | ||
134 | - </td> | ||
135 | - </tr> | ||
136 | - % endfor | ||
137 | - </tbody> | ||
138 | - </table> | 137 | + </small> |
138 | + </td> | ||
139 | + </tr> | ||
140 | + % endfor | ||
141 | + </tbody> | ||
142 | + </table> | ||
143 | + % endif | ||
139 | </div> <!-- panel --> | 144 | </div> <!-- panel --> |
140 | </div> <!-- container --> | 145 | </div> <!-- container --> |
141 | </body> | 146 | </body> |