]> git.llucax.com Git - software/sercom.git/blobdiff - sercom/subcontrollers/curso/ejercicio/instancia/templates/entregas.kid
Bugfix: faltó el validator :S
[software/sercom.git] / sercom / subcontrollers / curso / ejercicio / instancia / templates / entregas.kid
index b2e5bdb44018500d22bd3bcb2357cd54317ea573..579c3fa209cd5414897bc670f2ae3d534f88297b 100644 (file)
@@ -8,7 +8,7 @@
 </head>
 <body>
 
-<h1>Entregas para la Instancia de Entrega <span py:replace="instancia.shortrepr()">Objetos</span></h1>
+<h1>Entregas Realizadas</h1>
 
 <table class="list">
     <tr>
         <th>Observaciones</th>
                                <th>Operaciones</th>
     </tr>
-               <tr py:for="record in instancia.entregas">
+               <tr py:for="record in records">
                                <?python
                                        def contar_comandos_mal(prueba, publico):
                                                total = 0
+                                               tested = 0
                                                for c in prueba.comandos_ejecutados:
-                                                       if not c.exito and c.publico == publico:
-                                                               total += 1
-                                               return total
+                                                       if c.comando.publico == publico:
+                                                               if not c.exito:
+                                                                       total += 1
+                                                               tested += 1
+                                               return (total, tested)
 
-                                       if not record.exito:
-                                               # Reviso que tan mal esta
-                                               # si no hay pruebas, esta mal porque no anduvieron los comandos
-                                               if len(record.pruebas) == 0:
-                                                       color = "entregamal"
-                                               else:
-                                                       # Veo que onda con las pruebas
-                                                       pruebas_pub_mal = 0
-                                                       pruebas_priv_mal = 0
-                                                       for prueba in record.pruebas:
-                                                               if contar_comandos_mal(prueba, True) > 0:
-                                                                       pruebas_pub_mal += 1
-                                                               if contar_comandos_mal(prueba, False) > 0:
-                                                                       pruebas_priv_mal += 1
-                                                       if pruebas_pub_mal > 0:
-                                                               color = "entregamal"
-                                                       if pruebas_priv_mal > 0:
-                                                               color = "entregamal"
+                                       # Reviso que tan mal esta
+                                       # si no hay pruebas, esta mal porque no anduvieron los comandos
+                                       pruebas_pub_mal = 0
+                                       pruebas_priv_mal = 0
+                                       if len(record.pruebas) == 0:
+                                               color = "#ff0000"
                                        else:
-                                               # Todo Ok! 
-                                               color = "entregaok"
+                                               # Veo que onda con las pruebas
+                                               pri_mal = 0
+                                               pub_mal = 0
+                                               for prueba in record.pruebas:
+                                                       (rpub_mal, pub_tested) = contar_comandos_mal(prueba, True)
+                                                       (rpri_mal, pri_tested) = contar_comandos_mal(prueba, False)
+                                                       pri_mal += rpri_mal
+                                                       pub_mal += rpub_mal
+                                               if pri_mal + pub_mal == 0:
+                                                       color = "#00ff00"
+                                               else:
+                                                       if pub_mal > 0:
+                                                               color = "#ff0000"
+                                                       else:
+                                                               color = "#ffff00"
                                ?>
-                               <td class="${color}"><span py:if="record.entregador" py:replace="record.entregador.shortrepr()">usuario</span></td>
-        <td class="${color}"><span py:replace="record.exito">fecha asignado</span></td>
-        <td class="${color}"><span py:replace="record.inicio">fecha corregido</span></td>
-        <td class="${color}"><span py:replace="record.fin">fecha corregido</span></td>
-        <td class="${color}"><span py:replace="record.observaciones">nota</span></td>
+                               <td style="background:${color};"><span py:if="record.entregador" py:replace="record.entregador.shortrepr()">usuario</span></td>
+        <td style="background:${color};"><span py:replace="record.exito">fecha asignado</span></td>
+        <td style="background:${color};"><span py:replace="record.inicio">fecha corregido</span></td>
+        <td style="background:${color};"><span py:replace="record.fin">fecha corregido</span></td>
+        <td style="background:${color};"><span py:replace="record.observaciones">nota</span></td>
                                <td>
                                        <a href="${tg.url('/mis_entregas/corrida/%d' % record.id)}">Corrida</a>
                                        <a href="${tg.url('/mis_entregas/get_archivo/%d' % record.id)}">Bajar Archivo</a>
 </table>
 
 <br/>
-<a href="${tg.url('/curso/ejercicio/instancia/list/%s' % instancia.ejercicio.id)}">Volver</a>
+<a href="javascript:window.history.go(-1);">Volver</a>
+
+<div py:for="page in tg.paginate.pages">
+    <a py:if="page != tg.paginate.current_page"
+        href="${tg.paginate.get_href(page)}">${page}</a>
+    <b py:if="page == tg.paginate.current_page">${page}</b>
+</div>
 
 </body>
 </html>