Spaces:
Sleeping
Sleeping
Tabla para detalles de sesion con CATA, y RATA
Browse files- tecnicas/controllers/models_controller/calificacion_controller.py +1 -1
- tecnicas/controllers/views_controller/session_management/details_cata_controller.py +19 -7
- tecnicas/templates/tecnicas/components/{table-convencional.html → table-scales.html} +5 -1
- tecnicas/templates/tecnicas/components/table_cata.html +50 -0
- tecnicas/templates/tecnicas/manage_sesions/detalles-sesion-cata.html +1 -1
- tecnicas/templates/tecnicas/manage_sesions/detalles-sesion.html +1 -1
tecnicas/controllers/models_controller/calificacion_controller.py
CHANGED
|
@@ -21,7 +21,7 @@ class CalificacionController():
|
|
| 21 |
@staticmethod
|
| 22 |
def getRatingsByTechnique(technique: Tecnica):
|
| 23 |
repetition = technique.repeticion
|
| 24 |
-
ratings = list(Calificacion.objects.filter(id_tecnica=technique))
|
| 25 |
return ratings
|
| 26 |
|
| 27 |
@staticmethod
|
|
|
|
| 21 |
@staticmethod
|
| 22 |
def getRatingsByTechnique(technique: Tecnica):
|
| 23 |
repetition = technique.repeticion
|
| 24 |
+
ratings = list(Calificacion.objects.filter(id_tecnica=technique, num_repeticion=repetition))
|
| 25 |
return ratings
|
| 26 |
|
| 27 |
@staticmethod
|
tecnicas/controllers/views_controller/session_management/details_cata_controller.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
from django.http import HttpRequest
|
| 2 |
from django.shortcuts import render, redirect
|
| 3 |
-
from
|
| 4 |
-
from tecnicas.
|
|
|
|
| 5 |
from tecnicas.utils import defaultdict_to_dict
|
| 6 |
from .details_controller import DetallesController
|
| 7 |
from collections import defaultdict
|
|
@@ -29,16 +30,27 @@ class DetallesCATAController(DetallesController):
|
|
| 29 |
# Intentar recuperar las calificaciones
|
| 30 |
ratings_for_repetition = []
|
| 31 |
|
| 32 |
-
ratings =
|
| 33 |
-
|
| 34 |
|
| 35 |
-
if
|
| 36 |
self.context["calificaciones"] = ratings_for_repetition
|
| 37 |
self.context["existen_calificaciones"] = False
|
| 38 |
return self.context
|
| 39 |
|
| 40 |
-
data =
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
ratings_for_repetition = defaultdict(
|
| 44 |
lambda: defaultdict(lambda: defaultdict(list)))
|
|
|
|
| 1 |
from django.http import HttpRequest
|
| 2 |
from django.shortcuts import render, redirect
|
| 3 |
+
from django.db.models import F
|
| 4 |
+
from tecnicas.models import SesionSensorial, Calificacion, ValorBooleano
|
| 5 |
+
from tecnicas.controllers import PalabrasController, DatoController
|
| 6 |
from tecnicas.utils import defaultdict_to_dict
|
| 7 |
from .details_controller import DetallesController
|
| 8 |
from collections import defaultdict
|
|
|
|
| 30 |
# Intentar recuperar las calificaciones
|
| 31 |
ratings_for_repetition = []
|
| 32 |
|
| 33 |
+
ratings = list(Calificacion.objects.filter(
|
| 34 |
+
id_tecnica=technique))
|
| 35 |
|
| 36 |
+
if not ratings:
|
| 37 |
self.context["calificaciones"] = ratings_for_repetition
|
| 38 |
self.context["existen_calificaciones"] = False
|
| 39 |
return self.context
|
| 40 |
|
| 41 |
+
data = (
|
| 42 |
+
ValorBooleano.objects
|
| 43 |
+
.filter(id_dato__id_calificacion__in=ratings)
|
| 44 |
+
.values(
|
| 45 |
+
nombre_palabra=F("id_dato__id_palabra__nombre_palabra"),
|
| 46 |
+
repeticion=F("id_dato__id_calificacion__num_repeticion"),
|
| 47 |
+
producto_code=F(
|
| 48 |
+
"id_dato__id_calificacion__id_producto__codigoProducto"),
|
| 49 |
+
usuario_catador=F(
|
| 50 |
+
"id_dato__id_calificacion__id_catador__user__username"),
|
| 51 |
+
dato_valor=F("valor")
|
| 52 |
+
)
|
| 53 |
+
)
|
| 54 |
|
| 55 |
ratings_for_repetition = defaultdict(
|
| 56 |
lambda: defaultdict(lambda: defaultdict(list)))
|
tecnicas/templates/tecnicas/components/{table-convencional.html → table-scales.html}
RENAMED
|
@@ -4,7 +4,9 @@
|
|
| 4 |
<table id="convencional-table" class="min-w-max w-full text-sm text-center border-collapse">
|
| 5 |
<thead class="bg-surface-sweet text-black font-semibold">
|
| 6 |
<tr>
|
|
|
|
| 7 |
<th class="py-2 px-3 border border-surface-general">Repetición</th>
|
|
|
|
| 8 |
<th class="py-2 px-3 border border-surface-general">Usuario</th>
|
| 9 |
<th class="py-2 px-3 border border-surface-general">Producto</th>
|
| 10 |
{% for palabra in palabras %}
|
|
@@ -17,7 +19,9 @@
|
|
| 17 |
{% for usuario, productos in catadores.items %}
|
| 18 |
{% for codigo, valores in productos.items %}
|
| 19 |
<tr>
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
<td class="py-2 px-3 border border-surface-general">{{ usuario }}</td>
|
| 22 |
<td class="py-2 px-3 border border-surface-general">{{ codigo }}</td>
|
| 23 |
{% for palabra in palabras %}
|
|
|
|
| 4 |
<table id="convencional-table" class="min-w-max w-full text-sm text-center border-collapse">
|
| 5 |
<thead class="bg-surface-sweet text-black font-semibold">
|
| 6 |
<tr>
|
| 7 |
+
{% if sesion.tecnica.tipo_tecnica.nombre_tecnica != "rata" %}
|
| 8 |
<th class="py-2 px-3 border border-surface-general">Repetición</th>
|
| 9 |
+
{% endif %}
|
| 10 |
<th class="py-2 px-3 border border-surface-general">Usuario</th>
|
| 11 |
<th class="py-2 px-3 border border-surface-general">Producto</th>
|
| 12 |
{% for palabra in palabras %}
|
|
|
|
| 19 |
{% for usuario, productos in catadores.items %}
|
| 20 |
{% for codigo, valores in productos.items %}
|
| 21 |
<tr>
|
| 22 |
+
{% if sesion.tecnica.tipo_tecnica.nombre_tecnica != "rata" %}
|
| 23 |
+
<td class="py-2 px-3 border border-surface-general">{{ repeticion }}</td>
|
| 24 |
+
{% endif %}
|
| 25 |
<td class="py-2 px-3 border border-surface-general">{{ usuario }}</td>
|
| 26 |
<td class="py-2 px-3 border border-surface-general">{{ codigo }}</td>
|
| 27 |
{% for palabra in palabras %}
|
tecnicas/templates/tecnicas/components/table_cata.html
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% load static %}
|
| 2 |
+
<section>
|
| 3 |
+
<div class="overflow-x-auto rounded-lg border border-surface-general">
|
| 4 |
+
<table id="convencional-table" class="min-w-max w-full text-sm text-center border-collapse">
|
| 5 |
+
<thead class="bg-surface-sweet text-black font-semibold">
|
| 6 |
+
<tr>
|
| 7 |
+
<th class="py-2 px-3 border border-surface-general">Usuario</th>
|
| 8 |
+
<th class="py-2 px-3 border border-surface-general">Producto</th>
|
| 9 |
+
{% for palabra in palabras %}
|
| 10 |
+
<th class="py-2 px-3 border border-surface-general uppercase">{{ palabra }}</th>
|
| 11 |
+
{% endfor %}
|
| 12 |
+
</tr>
|
| 13 |
+
</thead>
|
| 14 |
+
<tbody class="bg-surface-ligt divide-y divide-gray-200">
|
| 15 |
+
{% for repeticion, catadores in calificaciones.items %}
|
| 16 |
+
{% for usuario, productos in catadores.items %}
|
| 17 |
+
{% for codigo, valores in productos.items %}
|
| 18 |
+
<tr>
|
| 19 |
+
<td class="py-2 px-3 border border-surface-general">{{ usuario }}</td>
|
| 20 |
+
<td class="py-2 px-3 border border-surface-general">{{ codigo }}</td>
|
| 21 |
+
{% for palabra in palabras %}
|
| 22 |
+
<td class="py-2 px-3 border border-surface-general">
|
| 23 |
+
{% for valor in valores %}
|
| 24 |
+
{% if valor.nombre_palabra == palabra %}
|
| 25 |
+
{% if valor.dato_valor %}
|
| 26 |
+
1
|
| 27 |
+
{% else %}
|
| 28 |
+
0
|
| 29 |
+
{% endif %}
|
| 30 |
+
{% endif %}
|
| 31 |
+
{% endfor %}
|
| 32 |
+
</td>
|
| 33 |
+
{% endfor %}
|
| 34 |
+
</tr>
|
| 35 |
+
{% endfor %}
|
| 36 |
+
{% endfor %}
|
| 37 |
+
{% endfor %}
|
| 38 |
+
</tbody>
|
| 39 |
+
</table>
|
| 40 |
+
</div>
|
| 41 |
+
|
| 42 |
+
<div class="flex justify-end mt-3">
|
| 43 |
+
<button id="download-csv-btn" class="cts-btn-general cts-btn-primary btn-push"
|
| 44 |
+
data-session-name="{% if sesion and sesion.nombre_sesion %}{{ sesion.nombre_sesion }}{% else %}{% endif %}"
|
| 45 |
+
data-session-code="{% if sesion and sesion.codigo_sesion %}{{ sesion.codigo_sesion }}{% else %}{% endif %}">
|
| 46 |
+
Descargar CSV
|
| 47 |
+
</button>
|
| 48 |
+
</div>
|
| 49 |
+
</section>
|
| 50 |
+
<script src="{% static 'js/download-table-csv.js' %}"></script>
|
tecnicas/templates/tecnicas/manage_sesions/detalles-sesion-cata.html
CHANGED
|
@@ -218,7 +218,7 @@
|
|
| 218 |
</p>
|
| 219 |
</section>
|
| 220 |
{% if existen_calificaciones %}
|
| 221 |
-
{% include "../components/
|
| 222 |
{% else %}
|
| 223 |
{% include "../components/error-message.html" with message='Sin calificaciones que mostrar aún' %}
|
| 224 |
{% endif %}
|
|
|
|
| 218 |
</p>
|
| 219 |
</section>
|
| 220 |
{% if existen_calificaciones %}
|
| 221 |
+
{% include "../components/table_cata.html" with calificaciones=calificaciones palabras=palabras sesion=sesion %}
|
| 222 |
{% else %}
|
| 223 |
{% include "../components/error-message.html" with message='Sin calificaciones que mostrar aún' %}
|
| 224 |
{% endif %}
|
tecnicas/templates/tecnicas/manage_sesions/detalles-sesion.html
CHANGED
|
@@ -260,7 +260,7 @@
|
|
| 260 |
Máximo valor por dato: <span class="font-bold">{{ scale.size }}</span>
|
| 261 |
</p>
|
| 262 |
</section>
|
| 263 |
-
{% include "../components/table-
|
| 264 |
</article>
|
| 265 |
{% else %}
|
| 266 |
{% include "../components/error-message.html" with message='Sin calificaciones que mostrar aún' %}
|
|
|
|
| 260 |
Máximo valor por dato: <span class="font-bold">{{ scale.size }}</span>
|
| 261 |
</p>
|
| 262 |
</section>
|
| 263 |
+
{% include "../components/table-scales.html" with calificaciones=calificaciones palabras=palabras sesion=sesion %}
|
| 264 |
</article>
|
| 265 |
{% else %}
|
| 266 |
{% include "../components/error-message.html" with message='Sin calificaciones que mostrar aún' %}
|