]> git.llucax.com Git - z.facultad/75.52/sercom.git/commitdiff
simplifico logica de colores y pagino las entregas de una instancia de entrega.
authorRicardo Markiewicz <rmarkie@fi.uba.ar>
Mon, 19 Mar 2007 01:57:40 +0000 (01:57 +0000)
committerRicardo Markiewicz <rmarkie@fi.uba.ar>
Mon, 19 Mar 2007 01:57:40 +0000 (01:57 +0000)
sercom/subcontrollers/correccion/templates/entregas.kid
sercom/subcontrollers/curso/ejercicio/instancia/__init__.py
sercom/subcontrollers/curso/ejercicio/instancia/templates/entregas.kid

index 4eb312bed6e49bf0480c342ba683c8fd4b78c30f..9313b440416caf6ba50ad2e6a7a2952f7160223e 100644 (file)
                                                # Veo que onda con las pruebas
                                                pri_mal = 0
                                                pub_mal = 0
-                                               pri_total = 0
-                                               pub_total = 0
-                                               color = "#000000"
                                                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
-                                                       pri_total += pri_tested
-                                                       pub_total += pub_tested
                                                if pri_mal + pub_mal == 0:
-                                                       color = "entregaok"
+                                                       color = "#00ff00"
                                                else:
-                                                       (r, g) = ("00", "00")
-                                                       r = hex(int(255 * (pub_mal*1.0 / pub_total)))[2:]
-                                                       g = hex(int(255 * ((pub_total-pub_mal)*1.0 / pub_total)))[2:]
-                                                       if len(r) < 2: r = "0"+r
-                                                       if len(g) < 2: g = "0"+g
-                                                       color = "#" + r + g + "00"
-
+                                                       if pub_mal > 0:
+                                                               color = "#ff0000"
+                                                       else:
+                                                               color = "#ffff00"
                                ?>
                                <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>
index 094311dbc404750305c0adfc7e0ebb6fba509053..1a29067a16148387e67678fd761dbf127889eb89 100644 (file)
@@ -133,9 +133,10 @@ class InstanciaController(controllers.Controller, identity.SecureResource):
         raise redirect('../list/%s' % ejercicio)
 
     @expose(template='kid:%s.templates.entregas' % __name__)
+    @paginate('records')
     def entregas(self,instanciaid, **kw):
         """Show record in model"""
         r = validate_get(instanciaid)
-        return dict(name=name, namepl=namepl, instancia=r)
+        return dict(name=name, namepl=namepl, records=r.entregas)
 #}}}
 
index aa9a9733d12bbea44a3af7635d06b32f0c4126a8..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>
@@ -19,7 +19,7 @@
         <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
                                                # Veo que onda con las pruebas
                                                pri_mal = 0
                                                pub_mal = 0
-                                               pri_total = 0
-                                               pub_total = 0
-                                               color = "#000000"
                                                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
-                                                       pri_total += pri_tested
-                                                       pub_total += pub_tested
                                                if pri_mal + pub_mal == 0:
-                                                       color = "entregaok"
+                                                       color = "#00ff00"
                                                else:
-                                                       (r, g) = ("00", "00")
-                                                       r = hex(int(255 * (pub_mal*1.0 / pub_total)))[2:]
-                                                       g = hex(int(255 * ((pub_total-pub_mal)*1.0 / pub_total)))[2:]
-                                                       if len(r) < 2: r = "0"+r
-                                                       if len(g) < 2: g = "0"+g
-                                                       color = "#" + r + g + "00"
-
+                                                       if pub_mal > 0:
+                                                               color = "#ff0000"
+                                                       else:
+                                                               color = "#ffff00"
                                ?>
                                <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>
 </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>