Spaces:
Sleeping
Sleeping
Se corrigen bugs al mostrar datos en detalles sesion
Browse files
tecnicas/controllers/views_controller/detalles_sesion_controller.py
CHANGED
|
@@ -39,7 +39,7 @@ class DetallesSesionController():
|
|
| 39 |
ratings = CalificacionController.getRatingsByTechnique(
|
| 40 |
technique=self.session.tecnica)
|
| 41 |
|
| 42 |
-
if not ratings:
|
| 43 |
self.context["calificaciones"] = ratings_for_repetition
|
| 44 |
self.context["existen_calificaciones"] = False
|
| 45 |
return self.context
|
|
|
|
| 39 |
ratings = CalificacionController.getRatingsByTechnique(
|
| 40 |
technique=self.session.tecnica)
|
| 41 |
|
| 42 |
+
if isinstance(ratings, dict) or not ratings:
|
| 43 |
self.context["calificaciones"] = ratings_for_repetition
|
| 44 |
self.context["existen_calificaciones"] = False
|
| 45 |
return self.context
|
tecnicas/models/dato.py
CHANGED
|
@@ -11,4 +11,4 @@ class Dato(models.Model):
|
|
| 11 |
Calificacion, on_delete=models.CASCADE, related_name="dato_calificacion")
|
| 12 |
|
| 13 |
def __str__(self):
|
| 14 |
-
return f"{self.id_palabra.nombre_palabra} - {self.id_calificacion.id_producto.codigoProducto}"
|
|
|
|
| 11 |
Calificacion, on_delete=models.CASCADE, related_name="dato_calificacion")
|
| 12 |
|
| 13 |
def __str__(self):
|
| 14 |
+
return f"{self.id_palabra.nombre_palabra} - {self.id_calificacion.id_producto.codigoProducto} - {self.id_calificacion.id_catador.usuarioCatador}"
|
tecnicas/models/dato_valor.py
CHANGED
|
@@ -2,16 +2,20 @@ from django.db import models
|
|
| 2 |
|
| 3 |
from .dato import Dato
|
| 4 |
|
|
|
|
| 5 |
class ValorDecimal(models.Model):
|
| 6 |
-
id_dato = models.OneToOneField(
|
|
|
|
| 7 |
valor = models.FloatField()
|
| 8 |
|
| 9 |
def __str__(self):
|
| 10 |
-
return f"{self.id} - {self.id_dato.id_palabra}: {self.valor}"
|
|
|
|
| 11 |
|
| 12 |
class ValorBooleano(models.Model):
|
| 13 |
-
id_dato = models.OneToOneField(
|
|
|
|
| 14 |
valor = models.BooleanField()
|
| 15 |
|
| 16 |
def __str__(self):
|
| 17 |
-
return f"{self.id} - {self.id_dato.id_palabra}: {self.valor}"
|
|
|
|
| 2 |
|
| 3 |
from .dato import Dato
|
| 4 |
|
| 5 |
+
|
| 6 |
class ValorDecimal(models.Model):
|
| 7 |
+
id_dato = models.OneToOneField(
|
| 8 |
+
Dato, on_delete=models.CASCADE, related_name="dato_decimal")
|
| 9 |
valor = models.FloatField()
|
| 10 |
|
| 11 |
def __str__(self):
|
| 12 |
+
return f"{self.id} - {self.id_dato.id_palabra}: {self.valor} - {self.id_dato.id_calificacion.id_catador.usuarioCatador}"
|
| 13 |
+
|
| 14 |
|
| 15 |
class ValorBooleano(models.Model):
|
| 16 |
+
id_dato = models.OneToOneField(
|
| 17 |
+
Dato, on_delete=models.CASCADE, related_name="dato_boolean")
|
| 18 |
valor = models.BooleanField()
|
| 19 |
|
| 20 |
def __str__(self):
|
| 21 |
+
return f"{self.id} - {self.id_dato.id_palabra}: {self.valor} - {self.id_dato.id_calificacion.id_catador.usuarioCatador}"
|
tecnicas/templates/tecnicas/manage_sesions/detalles-sesion.html
CHANGED
|
@@ -10,15 +10,13 @@
|
|
| 10 |
<h1 class="text-black rounded-xl font-bold text-2xl bg-surface-card shadow-lg p-4 flex-1">
|
| 11 |
Detalles de la sesión
|
| 12 |
</h1>
|
| 13 |
-
<
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
</button>
|
| 17 |
-
</a>
|
| 18 |
</header>
|
| 19 |
|
| 20 |
{% if error %}
|
| 21 |
-
<article class="bg-red-600 p-4 text-white rounded-xl ct-notification-error">
|
| 22 |
<p class="block font-sans text-white text-xl antialiased font-bold uppercase tracking-wider text-center">
|
| 23 |
{{ error }}
|
| 24 |
</p>
|
|
@@ -187,31 +185,30 @@
|
|
| 187 |
<section class="p-4 space-y-4">
|
| 188 |
<h2 class="text-lg font-bold mb-3">Repetición {{ repeticion }}</h2>
|
| 189 |
|
| 190 |
-
|
| 191 |
-
<div class="overflow-x-auto rounded-lg border border-gray-300">
|
| 192 |
<table class="min-w-max w-full text-sm text-center border-collapse">
|
| 193 |
-
<thead class="bg-
|
| 194 |
<tr>
|
| 195 |
-
<th class="py-2 px-3 border border-
|
| 196 |
-
<th class="py-2 px-3 border border-
|
| 197 |
{% for palabra in palabras %}
|
| 198 |
-
<th class="py-2 px-3 border border-
|
| 199 |
{% endfor %}
|
| 200 |
</tr>
|
| 201 |
</thead>
|
| 202 |
-
<tbody class="bg-
|
| 203 |
{% for usuario, productos in catadores.items %}
|
| 204 |
{% for codigo, valores in productos.items %}
|
| 205 |
<tr>
|
| 206 |
-
<td class="py-2 px-3 border border-
|
| 207 |
-
<td class="py-2 px-3 border border-
|
| 208 |
{% for valor in valores %}
|
| 209 |
-
<td class="py-2 px-3 border border-
|
| 210 |
{% if valor.dato_valor %}
|
| 211 |
{{ valor.nombre_palabra }} <br>
|
| 212 |
{{ valor.dato_valor }}
|
| 213 |
{% else %}
|
| 214 |
-
|
| 215 |
{% endif %}
|
| 216 |
</td>
|
| 217 |
{% endfor %}
|
|
@@ -244,47 +241,4 @@
|
|
| 244 |
|
| 245 |
{% block extra_js %}
|
| 246 |
<script src="{% static 'js/details-session.js' %}"></script>
|
| 247 |
-
{% endblock %}
|
| 248 |
-
|
| 249 |
-
<article class="bg-surface-card p-4 text-black rounded-xl space-y-10">
|
| 250 |
-
{% for repeticion, catadores in calificaciones.items %}
|
| 251 |
-
<section class="p-4 space-y-4">
|
| 252 |
-
<h2 class="text-lg font-bold mb-3">Repetición {{ repeticion }}</h2>
|
| 253 |
-
|
| 254 |
-
<div class="overflow-x-auto rounded-lg border border-gray-300">
|
| 255 |
-
<div class="min-w-max">
|
| 256 |
-
<div
|
| 257 |
-
class="grid grid-cols-{{ palabras|length|add:2 }} text-center font-semibold text-black text-sm bg-gray-200 rounded-t-lg [&_>*]:px-2 [&>*]:not-last:border-r border-b border-gray-300">
|
| 258 |
-
<div class="py-2">Usuario</div>
|
| 259 |
-
<div class="py-2">Producto</div>
|
| 260 |
-
{% for palabra in palabras %}
|
| 261 |
-
<div class="py-2">{{ palabra }}</div>
|
| 262 |
-
{% endfor %}
|
| 263 |
-
</div>
|
| 264 |
-
|
| 265 |
-
<ul class="divide-y divide-gray-300 text-black bg-white">
|
| 266 |
-
{% for usuario, productos in catadores.items %}
|
| 267 |
-
<li class="grid grid-cols-{{ palabras|length|add:2 }} text-center py-2 [&_>*]:px-2">
|
| 268 |
-
{% for codigo, valores in productos.items %}
|
| 269 |
-
<p class="border-r border-gray-300">{{ usuario }}</p>
|
| 270 |
-
<p class="border-r border-gray-300">{{ codigo }}</p>
|
| 271 |
-
{% for valor in valores %}
|
| 272 |
-
<p class="border-r border-gray-300">{{ valor.nombre_palabra }}<br>{{ valor.dato_valor }}
|
| 273 |
-
</p>
|
| 274 |
-
{% endfor %}
|
| 275 |
-
{% endfor %}
|
| 276 |
-
</li>
|
| 277 |
-
{% endfor %}
|
| 278 |
-
</ul>
|
| 279 |
-
</div>
|
| 280 |
-
</div>
|
| 281 |
-
|
| 282 |
-
<div class="flex justify-end mt-3">
|
| 283 |
-
<button
|
| 284 |
-
class="bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2 px-4 rounded-lg shadow transition">
|
| 285 |
-
Descargar CSV
|
| 286 |
-
</button>
|
| 287 |
-
</div>
|
| 288 |
-
</section>
|
| 289 |
-
{% endfor %}
|
| 290 |
-
</article>
|
|
|
|
| 10 |
<h1 class="text-black rounded-xl font-bold text-2xl bg-surface-card shadow-lg p-4 flex-1">
|
| 11 |
Detalles de la sesión
|
| 12 |
</h1>
|
| 13 |
+
<button class="cts-btn-general cts-btn-error btn-push" onclick="window.history.back()">
|
| 14 |
+
Volver a las Sesiones
|
| 15 |
+
</button>
|
|
|
|
|
|
|
| 16 |
</header>
|
| 17 |
|
| 18 |
{% if error %}
|
| 19 |
+
<article class=" bg-red-600 p-4 text-white rounded-xl ct-notification-error">
|
| 20 |
<p class="block font-sans text-white text-xl antialiased font-bold uppercase tracking-wider text-center">
|
| 21 |
{{ error }}
|
| 22 |
</p>
|
|
|
|
| 185 |
<section class="p-4 space-y-4">
|
| 186 |
<h2 class="text-lg font-bold mb-3">Repetición {{ repeticion }}</h2>
|
| 187 |
|
| 188 |
+
<div class="overflow-x-auto rounded-lg border border-surface-general">
|
|
|
|
| 189 |
<table class="min-w-max w-full text-sm text-center border-collapse">
|
| 190 |
+
<thead class="bg-surface-sweet text-black font-semibold">
|
| 191 |
<tr>
|
| 192 |
+
<th class="py-2 px-3 border border-surface-general">Usuario</th>
|
| 193 |
+
<th class="py-2 px-3 border border-surface-general">Producto</th>
|
| 194 |
{% for palabra in palabras %}
|
| 195 |
+
<th class="py-2 px-3 border border-surface-general uppercase">{{ palabra }}</th>
|
| 196 |
{% endfor %}
|
| 197 |
</tr>
|
| 198 |
</thead>
|
| 199 |
+
<tbody class="bg-surface-ligt divide-y divide-gray-200">
|
| 200 |
{% for usuario, productos in catadores.items %}
|
| 201 |
{% for codigo, valores in productos.items %}
|
| 202 |
<tr>
|
| 203 |
+
<td class="py-2 px-3 border border-surface-general">{{ usuario }}</td>
|
| 204 |
+
<td class="py-2 px-3 border border-surface-general">{{ codigo }}</td>
|
| 205 |
{% for valor in valores %}
|
| 206 |
+
<td class="py-2 px-3 border border-surface-general">
|
| 207 |
{% if valor.dato_valor %}
|
| 208 |
{{ valor.nombre_palabra }} <br>
|
| 209 |
{{ valor.dato_valor }}
|
| 210 |
{% else %}
|
| 211 |
+
0
|
| 212 |
{% endif %}
|
| 213 |
</td>
|
| 214 |
{% endfor %}
|
|
|
|
| 241 |
|
| 242 |
{% block extra_js %}
|
| 243 |
<script src="{% static 'js/details-session.js' %}"></script>
|
| 244 |
+
{% endblock %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tecnicas/views/sessions_management/session_details.py
CHANGED
|
@@ -16,8 +16,8 @@ def sessionDetails(req: HttpRequest, session_code: str):
|
|
| 16 |
response = DetallesSesionController.startRepetition(
|
| 17 |
session_code=session_code, username=req.POST["username"])
|
| 18 |
if isinstance(response, dict):
|
| 19 |
-
context["error"] = response["error"]
|
| 20 |
context = controller_view.getContextWithData()
|
|
|
|
| 21 |
return render(req, "tecnicas/manage_sesions/detalles-sesion.html", context)
|
| 22 |
return redirect(reverse("cata_system:monitor_sesion"))
|
| 23 |
elif req.POST.get("action") == "delete_session":
|
|
|
|
| 16 |
response = DetallesSesionController.startRepetition(
|
| 17 |
session_code=session_code, username=req.POST["username"])
|
| 18 |
if isinstance(response, dict):
|
|
|
|
| 19 |
context = controller_view.getContextWithData()
|
| 20 |
+
context["error"] = response["error"]
|
| 21 |
return render(req, "tecnicas/manage_sesions/detalles-sesion.html", context)
|
| 22 |
return redirect(reverse("cata_system:monitor_sesion"))
|
| 23 |
elif req.POST.get("action") == "delete_session":
|