Spaces:
Running
Running
Merge pull request #26 from CascoArcilla/HU9
Browse files- tecnicas/controllers/__init__.py +1 -0
- tecnicas/controllers/views_controller/session_management/details_escala_controller.py +15 -5
- tecnicas/controllers/views_controller/session_management/monitor_controller.py +54 -1
- tecnicas/controllers/views_controller/session_management/monitor_escalas_controller.py +18 -62
- tecnicas/controllers/views_controller/session_management/monitor_rata_controller.py +46 -0
- tecnicas/templates/tecnicas/components/table-convencional.html +22 -20
- tecnicas/templates/tecnicas/manage_sesions/detalles-sesion.html +9 -5
- tecnicas/views/sessions_management/session_monitor.py +13 -2
tecnicas/controllers/__init__.py
CHANGED
|
@@ -23,6 +23,7 @@ from .views_controller.session_management.details_escala_controller import Detal
|
|
| 23 |
from .views_controller.session_management.details_rata_controller import DetallesRATAController
|
| 24 |
from .views_controller.session_management.monitor_controller import MonitorController
|
| 25 |
from .views_controller.session_management.monitor_escalas_controller import MonitorEscalasController
|
|
|
|
| 26 |
|
| 27 |
from .views_controller.sessions_tester.login_session_tester_controller import LoginSessionTesterController
|
| 28 |
from .views_controller.sessions_tester.init_session_tester_controller import InitSessionTesterController
|
|
|
|
| 23 |
from .views_controller.session_management.details_rata_controller import DetallesRATAController
|
| 24 |
from .views_controller.session_management.monitor_controller import MonitorController
|
| 25 |
from .views_controller.session_management.monitor_escalas_controller import MonitorEscalasController
|
| 26 |
+
from .views_controller.session_management.monitor_rata_controller import MonitorRATAController
|
| 27 |
|
| 28 |
from .views_controller.sessions_tester.login_session_tester_controller import LoginSessionTesterController
|
| 29 |
from .views_controller.sessions_tester.init_session_tester_controller import InitSessionTesterController
|
tecnicas/controllers/views_controller/session_management/details_escala_controller.py
CHANGED
|
@@ -14,7 +14,7 @@ Encabezados de como deben de aparecer los datos juntos
|
|
| 14 |
from django.http import HttpRequest
|
| 15 |
from django.shortcuts import render, redirect
|
| 16 |
from django.urls import reverse
|
| 17 |
-
from tecnicas.models import SesionSensorial, Presentador, Participacion, Calificacion
|
| 18 |
from tecnicas.controllers import DatoController, PalabrasController, ParticipacionController
|
| 19 |
from .details_controller import DetallesController
|
| 20 |
from tecnicas.utils import defaultdict_to_dict, controller_error
|
|
@@ -44,16 +44,26 @@ class DetallesEscalasController(DetallesController):
|
|
| 44 |
}
|
| 45 |
self.context["sesion"] = self.session
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
# Recuperar la palabras de la tecnica
|
| 48 |
self.words = PalabrasController.getWordsInTechnique(
|
| 49 |
-
|
| 50 |
self.context["palabras"] = [word.nombre_palabra for word in self.words]
|
| 51 |
|
| 52 |
# Se recuperan las calificaciones
|
| 53 |
ratings_for_repetition = []
|
| 54 |
|
| 55 |
ratings = list(Calificacion.objects.filter(
|
| 56 |
-
id_tecnica=
|
| 57 |
|
| 58 |
if not ratings:
|
| 59 |
self.context["calificaciones"] = ratings_for_repetition
|
|
@@ -61,7 +71,7 @@ class DetallesEscalasController(DetallesController):
|
|
| 61 |
return self.context
|
| 62 |
|
| 63 |
data = DatoController.getWordValuesForConvecional(
|
| 64 |
-
ratings=ratings, technique=
|
| 65 |
|
| 66 |
ratings_for_repetition = defaultdict(
|
| 67 |
lambda: defaultdict(lambda: defaultdict(list)))
|
|
@@ -81,7 +91,7 @@ class DetallesEscalasController(DetallesController):
|
|
| 81 |
self.context["existen_calificaciones"] = True
|
| 82 |
|
| 83 |
# Se comprueba que ya no se pueda iniciar la repeticion
|
| 84 |
-
self.context["fin_repeticiones"] =
|
| 85 |
|
| 86 |
return self.context
|
| 87 |
|
|
|
|
| 14 |
from django.http import HttpRequest
|
| 15 |
from django.shortcuts import render, redirect
|
| 16 |
from django.urls import reverse
|
| 17 |
+
from tecnicas.models import SesionSensorial, Presentador, Participacion, Calificacion, Escala
|
| 18 |
from tecnicas.controllers import DatoController, PalabrasController, ParticipacionController
|
| 19 |
from .details_controller import DetallesController
|
| 20 |
from tecnicas.utils import defaultdict_to_dict, controller_error
|
|
|
|
| 44 |
}
|
| 45 |
self.context["sesion"] = self.session
|
| 46 |
|
| 47 |
+
technique = self.session.tecnica
|
| 48 |
+
|
| 49 |
+
# Datos de la escala usada
|
| 50 |
+
scale: Escala = technique.escala_tecnica
|
| 51 |
+
|
| 52 |
+
self.context["scale"] = {
|
| 53 |
+
"type": scale.id_tipo_escala.nombre_escala,
|
| 54 |
+
"size": scale.longitud
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
# Recuperar la palabras de la tecnica
|
| 58 |
self.words = PalabrasController.getWordsInTechnique(
|
| 59 |
+
technique)
|
| 60 |
self.context["palabras"] = [word.nombre_palabra for word in self.words]
|
| 61 |
|
| 62 |
# Se recuperan las calificaciones
|
| 63 |
ratings_for_repetition = []
|
| 64 |
|
| 65 |
ratings = list(Calificacion.objects.filter(
|
| 66 |
+
id_tecnica=technique))
|
| 67 |
|
| 68 |
if not ratings:
|
| 69 |
self.context["calificaciones"] = ratings_for_repetition
|
|
|
|
| 71 |
return self.context
|
| 72 |
|
| 73 |
data = DatoController.getWordValuesForConvecional(
|
| 74 |
+
ratings=ratings, technique=technique)
|
| 75 |
|
| 76 |
ratings_for_repetition = defaultdict(
|
| 77 |
lambda: defaultdict(lambda: defaultdict(list)))
|
|
|
|
| 91 |
self.context["existen_calificaciones"] = True
|
| 92 |
|
| 93 |
# Se comprueba que ya no se pueda iniciar la repeticion
|
| 94 |
+
self.context["fin_repeticiones"] = technique.repeticion >= technique.repeticiones_max
|
| 95 |
|
| 96 |
return self.context
|
| 97 |
|
tecnicas/controllers/views_controller/session_management/monitor_controller.py
CHANGED
|
@@ -1,6 +1,59 @@
|
|
| 1 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
|
| 4 |
class MonitorController():
|
|
|
|
|
|
|
|
|
|
| 5 |
def __init__(self, session: SesionSensorial):
|
| 6 |
self.sensorial_session = session
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.http import HttpRequest
|
| 2 |
+
from django.shortcuts import render
|
| 3 |
+
from tecnicas.models import SesionSensorial, Producto, EsAtributo, EsVocabulario
|
| 4 |
+
from tecnicas.controllers import ParticipacionController, SesionController
|
| 5 |
+
from tecnicas.utils import controller_error
|
| 6 |
|
| 7 |
|
| 8 |
class MonitorController():
|
| 9 |
+
url_view: str
|
| 10 |
+
previus_view: str
|
| 11 |
+
|
| 12 |
def __init__(self, session: SesionSensorial):
|
| 13 |
self.sensorial_session = session
|
| 14 |
+
|
| 15 |
+
def setContext(self):
|
| 16 |
+
self.participations = ParticipacionController.getParticipationsInTechinique(
|
| 17 |
+
self.sensorial_session.tecnica)
|
| 18 |
+
|
| 19 |
+
self.context = {
|
| 20 |
+
"code_session": self.sensorial_session.codigo_sesion,
|
| 21 |
+
"session_name": self.sensorial_session.nombre_sesion,
|
| 22 |
+
"max_testers": self.sensorial_session.tecnica.limite_catadores,
|
| 23 |
+
"current_testers": len(self.participations),
|
| 24 |
+
"active_testers": len([part for part in self.participations if part.activo]),
|
| 25 |
+
"participations": self.participations,
|
| 26 |
+
"use_technique": self.sensorial_session.tecnica.tipo_tecnica.nombre_tecnica
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
def controlGetResponse(self, request: HttpRequest, error: str = "", message: str = ""):
|
| 30 |
+
self.setContext()
|
| 31 |
+
|
| 32 |
+
if error != "" or error:
|
| 33 |
+
self.context["error"] = error
|
| 34 |
+
if message != "" or message:
|
| 35 |
+
self.context["message"] = message
|
| 36 |
+
|
| 37 |
+
return render(request, self.url_view, self.context)
|
| 38 |
+
|
| 39 |
+
def getExpectedRatingsEscalasRapida(self):
|
| 40 |
+
num_products = Producto.objects.filter(
|
| 41 |
+
id_tecnica=self.sensorial_session.tecnica).count()
|
| 42 |
+
style_words = self.sensorial_session.tecnica.id_estilo
|
| 43 |
+
num_words: int
|
| 44 |
+
|
| 45 |
+
if style_words.nombre_estilo == "atributos":
|
| 46 |
+
num_words = EsAtributo.objects.get(
|
| 47 |
+
id_tecnica=self.sensorial_session.tecnica).palabras.count()
|
| 48 |
+
elif style_words.nombre_estilo == "vocabulario":
|
| 49 |
+
num_words = EsVocabulario.objects.get(
|
| 50 |
+
id_tecnica=self.sensorial_session.tecnica).id_vocabulario.palabras.count()
|
| 51 |
+
|
| 52 |
+
return num_products * num_words
|
| 53 |
+
|
| 54 |
+
def finishSession(self):
|
| 55 |
+
response = SesionController.finishRepetion(self.sensorial_session)
|
| 56 |
+
if isinstance(response, dict):
|
| 57 |
+
return controller_error(response["error"])
|
| 58 |
+
self.sensorial_session.refresh_from_db()
|
| 59 |
+
return self.sensorial_session
|
tecnicas/controllers/views_controller/session_management/monitor_escalas_controller.py
CHANGED
|
@@ -1,93 +1,49 @@
|
|
| 1 |
from django.http import HttpRequest
|
| 2 |
from django.shortcuts import render, redirect
|
| 3 |
from django.urls import reverse
|
| 4 |
-
from tecnicas.models import
|
| 5 |
-
from tecnicas.controllers import
|
| 6 |
-
from tecnicas.utils import controller_error
|
| 7 |
from .monitor_controller import MonitorController
|
| 8 |
|
| 9 |
|
| 10 |
class MonitorEscalasController(MonitorController):
|
| 11 |
-
url_view = "tecnicas/manage_sesions/monitor-sesion.html"
|
| 12 |
-
|
| 13 |
def __init__(self, session: SesionController):
|
| 14 |
super().__init__(session)
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
def
|
| 17 |
-
self.setContext()
|
| 18 |
-
|
| 19 |
-
if error != "" or error:
|
| 20 |
-
self.context["error"] = error
|
| 21 |
-
if message != "" or message:
|
| 22 |
-
self.context["message"] = message
|
| 23 |
-
|
| 24 |
-
return render(request, self.url_view, self.context)
|
| 25 |
-
|
| 26 |
-
def controlPostResponseFinishSession(self, request: HttpRequest):
|
| 27 |
self.setContext()
|
| 28 |
-
(is_all_end, message) = self.
|
| 29 |
if not is_all_end:
|
| 30 |
self.context["error"] = message
|
| 31 |
-
return render(request,
|
| 32 |
response = self.finishSession()
|
| 33 |
if isinstance(response, dict):
|
| 34 |
self.context["error"] = response["error"]
|
| 35 |
-
return render(request,
|
| 36 |
self.context["message"] = message
|
| 37 |
-
return redirect(reverse(
|
| 38 |
-
|
| 39 |
-
def setContext(self):
|
| 40 |
-
self.participations = ParticipacionController.getParticipationsInTechinique(
|
| 41 |
-
self.sensorial_session.tecnica)
|
| 42 |
|
| 43 |
-
|
| 44 |
-
"code_session": self.sensorial_session.codigo_sesion,
|
| 45 |
-
"session_name": self.sensorial_session.nombre_sesion,
|
| 46 |
-
"max_testers": self.sensorial_session.tecnica.limite_catadores,
|
| 47 |
-
"current_testers": len(self.participations),
|
| 48 |
-
"active_testers": len([part for part in self.participations if part.activo]),
|
| 49 |
-
"participations": self.participations,
|
| 50 |
-
"use_technique": self.sensorial_session.tecnica.tipo_tecnica.nombre_tecnica
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
def getExpectedRatings(self):
|
| 54 |
-
num_products = Producto.objects.filter(
|
| 55 |
-
id_tecnica=self.sensorial_session.tecnica).count()
|
| 56 |
-
style_words = self.sensorial_session.tecnica.id_estilo
|
| 57 |
-
num_words: int
|
| 58 |
-
|
| 59 |
-
if style_words.nombre_estilo == "atributos":
|
| 60 |
-
num_words = EsAtributo.objects.get(
|
| 61 |
-
id_tecnica=self.sensorial_session.tecnica).palabras.count()
|
| 62 |
-
elif style_words.nombre_estilo == "vocabulario":
|
| 63 |
-
num_words = EsVocabulario.objects.get(
|
| 64 |
-
id_tecnica=self.sensorial_session.tecnica).id_vocabulario.palabras.count()
|
| 65 |
-
|
| 66 |
-
return num_products * num_words
|
| 67 |
-
|
| 68 |
-
def checkAllParticipantsEnded(self):
|
| 69 |
technique = self.sensorial_session.tecnica
|
| 70 |
|
| 71 |
-
expected_ratings_repetition = self.
|
| 72 |
|
| 73 |
-
all_participations =
|
| 74 |
-
|
| 75 |
|
| 76 |
if len(all_participations) < technique.limite_catadores:
|
| 77 |
return (False, "No se ha alcanzado el número máximo de Catadores")
|
| 78 |
|
| 79 |
for particiapation in all_participations:
|
| 80 |
-
num_ratings_now =
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
if num_ratings_now < expected_ratings_repetition:
|
| 84 |
return (False, "No todos los catadores han finalizado su evaluación")
|
| 85 |
|
| 86 |
return (True, "Puedes finalizar la sesión")
|
| 87 |
-
|
| 88 |
-
def finishSession(self):
|
| 89 |
-
response = SesionController.finishRepetion(self.sensorial_session)
|
| 90 |
-
if isinstance(response, dict):
|
| 91 |
-
return controller_error(response["error"])
|
| 92 |
-
self.sensorial_session.refresh_from_db()
|
| 93 |
-
return self.sensorial_session
|
|
|
|
| 1 |
from django.http import HttpRequest
|
| 2 |
from django.shortcuts import render, redirect
|
| 3 |
from django.urls import reverse
|
| 4 |
+
from tecnicas.models import Dato, Participacion
|
| 5 |
+
from tecnicas.controllers import SesionController
|
|
|
|
| 6 |
from .monitor_controller import MonitorController
|
| 7 |
|
| 8 |
|
| 9 |
class MonitorEscalasController(MonitorController):
|
|
|
|
|
|
|
| 10 |
def __init__(self, session: SesionController):
|
| 11 |
super().__init__(session)
|
| 12 |
+
self.url_view = "tecnicas/manage_sesions/monitor-sesion.html"
|
| 13 |
+
self.previus_view = "cata_system:detalles_sesion"
|
| 14 |
|
| 15 |
+
def controllPostFinishSession(self, request: HttpRequest):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
self.setContext()
|
| 17 |
+
(is_all_end, message) = self.checkAllFinish()
|
| 18 |
if not is_all_end:
|
| 19 |
self.context["error"] = message
|
| 20 |
+
return render(request, self.url_view, self.context)
|
| 21 |
response = self.finishSession()
|
| 22 |
if isinstance(response, dict):
|
| 23 |
self.context["error"] = response["error"]
|
| 24 |
+
return render(request, self.url_view, self.context)
|
| 25 |
self.context["message"] = message
|
| 26 |
+
return redirect(reverse(self.previus_view, kwargs={"session_code": self.sensorial_session.codigo_sesion}))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
+
def checkAllFinish(self):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
technique = self.sensorial_session.tecnica
|
| 30 |
|
| 31 |
+
expected_ratings_repetition = self.getExpectedRatingsEscalasRapida()
|
| 32 |
|
| 33 |
+
all_participations = list(
|
| 34 |
+
Participacion.objects.filter(tecnica=technique))
|
| 35 |
|
| 36 |
if len(all_participations) < technique.limite_catadores:
|
| 37 |
return (False, "No se ha alcanzado el número máximo de Catadores")
|
| 38 |
|
| 39 |
for particiapation in all_participations:
|
| 40 |
+
num_ratings_now = Dato.objects.filter(
|
| 41 |
+
id_calificacion__num_repeticion=technique.repeticion,
|
| 42 |
+
id_calificacion__id_catador=particiapation.catador,
|
| 43 |
+
id_calificacion__id_tecnica=technique
|
| 44 |
+
).count()
|
| 45 |
|
| 46 |
if num_ratings_now < expected_ratings_repetition:
|
| 47 |
return (False, "No todos los catadores han finalizado su evaluación")
|
| 48 |
|
| 49 |
return (True, "Puedes finalizar la sesión")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tecnicas/controllers/views_controller/session_management/monitor_rata_controller.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.http import HttpRequest
|
| 2 |
+
from django.shortcuts import render, redirect
|
| 3 |
+
from django.urls import reverse
|
| 4 |
+
from tecnicas.models import Dato, Participacion
|
| 5 |
+
from tecnicas.controllers import SesionController
|
| 6 |
+
from .monitor_controller import MonitorController
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class MonitorRATAController(MonitorController):
|
| 10 |
+
def __init__(self, session: SesionController):
|
| 11 |
+
super().__init__(session)
|
| 12 |
+
self.url_view = "tecnicas/manage_sesions/monitor-sesion.html"
|
| 13 |
+
self.previus_view = "cata_system:detalles_sesion"
|
| 14 |
+
|
| 15 |
+
def controllPostFinishSession(self, request: HttpRequest):
|
| 16 |
+
self.setContext()
|
| 17 |
+
(is_all_end, message) = self.checkAllFinish()
|
| 18 |
+
if not is_all_end:
|
| 19 |
+
self.context["error"] = message
|
| 20 |
+
return render(request, self.url_view, self.context)
|
| 21 |
+
response = self.finishSession()
|
| 22 |
+
if isinstance(response, dict):
|
| 23 |
+
self.context["error"] = response["error"]
|
| 24 |
+
return render(request, self.url_view, self.context)
|
| 25 |
+
self.context["message"] = message
|
| 26 |
+
return redirect(reverse(self.previus_view, kwargs={"session_code": self.sensorial_session.codigo_sesion}))
|
| 27 |
+
|
| 28 |
+
def checkAllFinish(self):
|
| 29 |
+
technique = self.sensorial_session.tecnica
|
| 30 |
+
|
| 31 |
+
expected_ratings_repetition = self.getExpectedRatingsEscalasRapida()
|
| 32 |
+
|
| 33 |
+
all_participations = list(
|
| 34 |
+
Participacion.objects.filter(tecnica=technique))
|
| 35 |
+
|
| 36 |
+
for particiapation in all_participations:
|
| 37 |
+
num_ratings_now = Dato.objects.filter(
|
| 38 |
+
id_calificacion__num_repeticion=technique.repeticion,
|
| 39 |
+
id_calificacion__id_catador=particiapation.catador,
|
| 40 |
+
id_calificacion__id_tecnica=technique
|
| 41 |
+
).count()
|
| 42 |
+
|
| 43 |
+
if num_ratings_now < expected_ratings_repetition:
|
| 44 |
+
return (False, "No todos los catadores han finalizado su evaluación")
|
| 45 |
+
|
| 46 |
+
return (True, "Puedes finalizar la sesión")
|
tecnicas/templates/tecnicas/components/table-convencional.html
CHANGED
|
@@ -1,10 +1,9 @@
|
|
| 1 |
<section>
|
| 2 |
-
<h2 class="text-lg font-bold mb-3">Repetición {{ repeticion }}</h2>
|
| 3 |
-
|
| 4 |
<div class="overflow-x-auto rounded-lg border border-surface-general">
|
| 5 |
<table class="min-w-max w-full text-sm text-center border-collapse">
|
| 6 |
<thead class="bg-surface-sweet text-black font-semibold">
|
| 7 |
<tr>
|
|
|
|
| 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 %}
|
|
@@ -13,26 +12,29 @@
|
|
| 13 |
</tr>
|
| 14 |
</thead>
|
| 15 |
<tbody class="bg-surface-ligt divide-y divide-gray-200">
|
| 16 |
-
{% for
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
{% endfor %}
|
| 30 |
-
{% if not match %}0{% endif %}
|
| 31 |
-
{% endwith %}
|
| 32 |
-
</td>
|
| 33 |
{% endfor %}
|
| 34 |
-
</tr>
|
| 35 |
-
{% endfor %}
|
| 36 |
{% endfor %}
|
| 37 |
</tbody>
|
| 38 |
</table>
|
|
|
|
| 1 |
<section>
|
|
|
|
|
|
|
| 2 |
<div class="overflow-x-auto rounded-lg border border-surface-general">
|
| 3 |
<table class="min-w-max w-full text-sm text-center border-collapse">
|
| 4 |
<thead class="bg-surface-sweet text-black font-semibold">
|
| 5 |
<tr>
|
| 6 |
+
<th class="py-2 px-3 border border-surface-general">Repetición</th>
|
| 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 %}
|
|
|
|
| 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">{{ repeticion }}</td>
|
| 20 |
+
<td class="py-2 px-3 border border-surface-general">{{ usuario }}</td>
|
| 21 |
+
<td class="py-2 px-3 border border-surface-general">{{ codigo }}</td>
|
| 22 |
+
{% for palabra in palabras %}
|
| 23 |
+
<td class="py-2 px-3 border border-surface-general">
|
| 24 |
+
{% with match=False %}
|
| 25 |
+
{% for valor in valores %}
|
| 26 |
+
{% if valor.nombre_palabra == palabra %}
|
| 27 |
+
{{ valor.dato_valor }}
|
| 28 |
+
{% with match=True %}{% endwith %}
|
| 29 |
+
{% endif %}
|
| 30 |
+
{% endfor %}
|
| 31 |
+
{% if match %}0{% endif %}
|
| 32 |
+
{% endwith %}
|
| 33 |
+
</td>
|
| 34 |
+
{% endfor %}
|
| 35 |
+
</tr>
|
| 36 |
{% endfor %}
|
|
|
|
|
|
|
|
|
|
| 37 |
{% endfor %}
|
|
|
|
|
|
|
| 38 |
{% endfor %}
|
| 39 |
</tbody>
|
| 40 |
</table>
|
tecnicas/templates/tecnicas/manage_sesions/detalles-sesion.html
CHANGED
|
@@ -252,11 +252,15 @@
|
|
| 252 |
|
| 253 |
{% if existen_calificaciones %}
|
| 254 |
<article class="bg-surface-card p-4 max-sm:px-2 text-black rounded">
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
</article>
|
| 261 |
{% else %}
|
| 262 |
{% include "../components/error-message.html" with message='Sin calificaciones que mostrar aún' %}
|
|
|
|
| 252 |
|
| 253 |
{% if existen_calificaciones %}
|
| 254 |
<article class="bg-surface-card p-4 max-sm:px-2 text-black rounded">
|
| 255 |
+
<section class="text-xl space-y-4 space-x-4 mb-4">
|
| 256 |
+
<p class="inline italic underline font-semibold">
|
| 257 |
+
Tipo de escala: <span class="font-bold uppercase">{{ scale.type }}</span>
|
| 258 |
+
</p>
|
| 259 |
+
<p class="inline italic underline font-semibold">
|
| 260 |
+
Máximo valor por dato: <span class="font-bold">{{ scale.size }}</span>
|
| 261 |
+
</p>
|
| 262 |
+
</section>
|
| 263 |
+
{% include "../components/table-convencional.html" with calificaciones=calificaciones palabras=palabras %}
|
| 264 |
</article>
|
| 265 |
{% else %}
|
| 266 |
{% include "../components/error-message.html" with message='Sin calificaciones que mostrar aún' %}
|
tecnicas/views/sessions_management/session_monitor.py
CHANGED
|
@@ -8,7 +8,7 @@ from django.http import HttpRequest, JsonResponse
|
|
| 8 |
from django.shortcuts import render, redirect
|
| 9 |
from django.urls import reverse
|
| 10 |
from tecnicas.models import SesionSensorial
|
| 11 |
-
from tecnicas.controllers import MonitorEscalasController
|
| 12 |
from tecnicas.utils import noValidTechnique
|
| 13 |
|
| 14 |
|
|
@@ -41,8 +41,19 @@ def sessionMonitor(req: HttpRequest, session_code: str):
|
|
| 41 |
if use_techinique == "escalas":
|
| 42 |
controll_view = MonitorEscalasController(sensorial_session)
|
| 43 |
action = req.POST["action"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
if action == "finish_session":
|
| 45 |
-
response = controll_view.
|
| 46 |
request=req)
|
| 47 |
else:
|
| 48 |
response = controll_view.controlGetResponse(
|
|
|
|
| 8 |
from django.shortcuts import render, redirect
|
| 9 |
from django.urls import reverse
|
| 10 |
from tecnicas.models import SesionSensorial
|
| 11 |
+
from tecnicas.controllers import MonitorEscalasController, MonitorRATAController
|
| 12 |
from tecnicas.utils import noValidTechnique
|
| 13 |
|
| 14 |
|
|
|
|
| 41 |
if use_techinique == "escalas":
|
| 42 |
controll_view = MonitorEscalasController(sensorial_session)
|
| 43 |
action = req.POST["action"]
|
| 44 |
+
|
| 45 |
+
if action == "finish_session":
|
| 46 |
+
response = controll_view.controllPostFinishSession(
|
| 47 |
+
request=req)
|
| 48 |
+
else:
|
| 49 |
+
response = controll_view.controlGetResponse(
|
| 50 |
+
request=req, error="No se ha definido la acción a realizar")
|
| 51 |
+
elif use_techinique == "rata":
|
| 52 |
+
controll_view = MonitorRATAController(sensorial_session)
|
| 53 |
+
action = req.POST["action"]
|
| 54 |
+
|
| 55 |
if action == "finish_session":
|
| 56 |
+
response = controll_view.controllPostFinishSession(
|
| 57 |
request=req)
|
| 58 |
else:
|
| 59 |
response = controll_view.controlGetResponse(
|