Spaces:
Sleeping
Sleeping
Desatalles para sesion con CATA
Browse files- tecnicas/controllers/__init__.py +1 -0
- tecnicas/controllers/models_controller/particiapacion_controller.py +3 -13
- tecnicas/controllers/views_controller/session_management/details_cata_controller.py +62 -0
- tecnicas/controllers/views_controller/session_management/details_controller.py +54 -4
- tecnicas/controllers/views_controller/session_management/details_escala_controller.py +6 -49
- tecnicas/controllers/views_controller/session_management/details_rata_controller.py +0 -44
- tecnicas/templates/tecnicas/manage_sesions/detalles-sesion-cata.html +238 -0
- tecnicas/views/sessions_management/session_details.py +7 -2
tecnicas/controllers/__init__.py
CHANGED
|
@@ -21,6 +21,7 @@ from .views_controller.create_session.panel_create_controller import PanelCreate
|
|
| 21 |
from .views_controller.session_management.details_controller import DetallesController
|
| 22 |
from .views_controller.session_management.details_escala_controller import DetallesEscalasController
|
| 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
|
|
|
|
| 21 |
from .views_controller.session_management.details_controller import DetallesController
|
| 22 |
from .views_controller.session_management.details_escala_controller import DetallesEscalasController
|
| 23 |
from .views_controller.session_management.details_rata_controller import DetallesRATAController
|
| 24 |
+
from .views_controller.session_management.details_cata_controller import DetallesCATAController
|
| 25 |
from .views_controller.session_management.monitor_controller import MonitorController
|
| 26 |
from .views_controller.session_management.monitor_escalas_controller import MonitorEscalasController
|
| 27 |
from .views_controller.session_management.monitor_rata_controller import MonitorRATAController
|
tecnicas/controllers/models_controller/particiapacion_controller.py
CHANGED
|
@@ -35,24 +35,14 @@ class ParticipacionController():
|
|
| 35 |
return controller_error("No se ha encontrado la participación")
|
| 36 |
|
| 37 |
@staticmethod
|
| 38 |
-
def outAllInSession(session: SesionSensorial
|
| 39 |
try:
|
| 40 |
-
if isinstance(session, str):
|
| 41 |
-
use_session = SesionSensorial.objects.get(
|
| 42 |
-
codigo_sesion=session)
|
| 43 |
-
else:
|
| 44 |
-
use_session = session
|
| 45 |
-
|
| 46 |
participations = Participacion.objects.filter(
|
| 47 |
-
tecnica=
|
| 48 |
-
|
| 49 |
-
if not participations.exists():
|
| 50 |
-
message = "No se encontraron participaciones en la sesión"
|
| 51 |
-
return (False, message)
|
| 52 |
|
| 53 |
participations.update(finalizado=False)
|
| 54 |
|
| 55 |
-
message = "Participaciones actualizadas a finalizadas"
|
| 56 |
return (True, message)
|
| 57 |
except Exception as e:
|
| 58 |
print(f"Error al actualizar las participaciones: {str(e)}")
|
|
|
|
| 35 |
return controller_error("No se ha encontrado la participación")
|
| 36 |
|
| 37 |
@staticmethod
|
| 38 |
+
def outAllInSession(session: SesionSensorial):
|
| 39 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
participations = Participacion.objects.filter(
|
| 41 |
+
tecnica=session.tecnica)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
participations.update(finalizado=False)
|
| 44 |
|
| 45 |
+
message = "Participaciones actualizadas a finalizadas como falso"
|
| 46 |
return (True, message)
|
| 47 |
except Exception as e:
|
| 48 |
print(f"Error al actualizar las participaciones: {str(e)}")
|
tecnicas/controllers/views_controller/session_management/details_cata_controller.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.http import HttpRequest
|
| 2 |
+
from django.shortcuts import render, redirect
|
| 3 |
+
from tecnicas.models import SesionSensorial
|
| 4 |
+
from tecnicas.controllers import PalabrasController, DatoController, CalificacionController
|
| 5 |
+
from tecnicas.utils import defaultdict_to_dict
|
| 6 |
+
from .details_controller import DetallesController
|
| 7 |
+
from collections import defaultdict
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class DetallesCATAController(DetallesController):
|
| 11 |
+
def __init__(self, session: SesionSensorial):
|
| 12 |
+
super().__init__(session)
|
| 13 |
+
self.url_template = "tecnicas/manage_sesions/detalles-sesion-cata.html"
|
| 14 |
+
self.url_next = "cata_system:monitor_sesion"
|
| 15 |
+
|
| 16 |
+
def getContext(self):
|
| 17 |
+
technique = self.session.tecnica
|
| 18 |
+
|
| 19 |
+
self.context = {
|
| 20 |
+
"sesion": self.session,
|
| 21 |
+
"use_technique": technique
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
# Recuperar palabras
|
| 25 |
+
self.words = PalabrasController.getWordsInTechnique(
|
| 26 |
+
self.session.tecnica)
|
| 27 |
+
self.context["palabras"] = [word.nombre_palabra for word in self.words]
|
| 28 |
+
|
| 29 |
+
# Intentar recuperar las calificaciones
|
| 30 |
+
ratings_for_repetition = []
|
| 31 |
+
|
| 32 |
+
ratings = CalificacionController.getRatingsByTechnique(
|
| 33 |
+
technique=technique)
|
| 34 |
+
|
| 35 |
+
if isinstance(ratings, dict) or not ratings:
|
| 36 |
+
self.context["calificaciones"] = ratings_for_repetition
|
| 37 |
+
self.context["existen_calificaciones"] = False
|
| 38 |
+
return self.context
|
| 39 |
+
|
| 40 |
+
data = DatoController.getWordValuesForConvecional(
|
| 41 |
+
ratings=ratings, technique=technique)
|
| 42 |
+
|
| 43 |
+
ratings_for_repetition = defaultdict(
|
| 44 |
+
lambda: defaultdict(lambda: defaultdict(list)))
|
| 45 |
+
|
| 46 |
+
for item in data:
|
| 47 |
+
user = item["usuario_catador"]
|
| 48 |
+
rep = item["repeticion"]
|
| 49 |
+
prod = item["producto_code"]
|
| 50 |
+
|
| 51 |
+
ratings_for_repetition[rep][user][prod].append({
|
| 52 |
+
"nombre_palabra": item["nombre_palabra"],
|
| 53 |
+
"dato_valor": item["dato_valor"]
|
| 54 |
+
})
|
| 55 |
+
|
| 56 |
+
self.context["calificaciones"] = defaultdict_to_dict(
|
| 57 |
+
ratings_for_repetition)
|
| 58 |
+
self.context["existen_calificaciones"] = True
|
| 59 |
+
|
| 60 |
+
# Se comprueba que ya no se pueda iniciar la repeticion
|
| 61 |
+
self.context["fin_repeticiones"] = technique.repeticion >= technique.repeticiones_max
|
| 62 |
+
return self.context
|
tecnicas/controllers/views_controller/session_management/details_controller.py
CHANGED
|
@@ -1,13 +1,63 @@
|
|
| 1 |
-
from
|
| 2 |
-
from
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
|
| 5 |
class DetallesController():
|
| 6 |
-
url_template
|
|
|
|
| 7 |
|
| 8 |
def __init__(self, session: SesionSensorial):
|
| 9 |
self.session = session
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
def deleteSesorialSession(self):
|
| 12 |
technique = Tecnica.objects.get(id=self.session.tecnica.id)
|
| 13 |
-
technique.delete()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.http import HttpRequest
|
| 2 |
+
from django.shortcuts import render, redirect
|
| 3 |
+
from django.urls import reverse
|
| 4 |
+
from tecnicas.models import SesionSensorial, Presentador, Tecnica, Participacion
|
| 5 |
+
from tecnicas.controllers import ParticipacionController
|
| 6 |
|
| 7 |
|
| 8 |
class DetallesController():
|
| 9 |
+
url_template: str
|
| 10 |
+
url_next: str
|
| 11 |
|
| 12 |
def __init__(self, session: SesionSensorial):
|
| 13 |
self.session = session
|
| 14 |
|
| 15 |
+
def controllGetResponse(self, request: HttpRequest, error: str = "", message: str = ""):
|
| 16 |
+
context = self.getContext()
|
| 17 |
+
|
| 18 |
+
if error != "" or error:
|
| 19 |
+
context["error"] = error
|
| 20 |
+
if message != "" or message:
|
| 21 |
+
context["message"] = message
|
| 22 |
+
|
| 23 |
+
return render(
|
| 24 |
+
request, self.url_template, context)
|
| 25 |
+
|
| 26 |
+
def getContext(self):
|
| 27 |
+
return {}
|
| 28 |
+
|
| 29 |
def deleteSesorialSession(self):
|
| 30 |
technique = Tecnica.objects.get(id=self.session.tecnica.id)
|
| 31 |
+
technique.delete()
|
| 32 |
+
|
| 33 |
+
def startRepetition(self, presenter: Presentador, request: HttpRequest):
|
| 34 |
+
creator = presenter
|
| 35 |
+
technique = self.session.tecnica
|
| 36 |
+
|
| 37 |
+
if creator.user.username != self.session.creadoPor.user.username:
|
| 38 |
+
return self.getResponse(error="Solo el presentador que crea la sesión puede iniciar la repetición", request=request)
|
| 39 |
+
elif self.session.activo:
|
| 40 |
+
return self.getResponse(error="La sesión ya está activada", request=request)
|
| 41 |
+
elif technique.repeticion >= technique.repeticiones_max:
|
| 42 |
+
return self.getResponse(error="Se ha alcanzado el número de repeticiones máxima", request=request)
|
| 43 |
+
|
| 44 |
+
there_participacions = Participacion.objects.filter(
|
| 45 |
+
tecnica=technique).exists()
|
| 46 |
+
|
| 47 |
+
if there_participacions:
|
| 48 |
+
(is_update_participations,
|
| 49 |
+
message) = ParticipacionController.outAllInSession(self.session)
|
| 50 |
+
if not is_update_participations:
|
| 51 |
+
return self.getResponse(error=message, request=request)
|
| 52 |
+
|
| 53 |
+
self.session.activo = True
|
| 54 |
+
technique.repeticion = technique.repeticion + 1
|
| 55 |
+
|
| 56 |
+
technique.save()
|
| 57 |
+
self.session.save()
|
| 58 |
+
|
| 59 |
+
parameters = {
|
| 60 |
+
"session_code": self.session.codigo_sesion
|
| 61 |
+
}
|
| 62 |
+
return redirect(
|
| 63 |
+
reverse(self.url_next, kwargs=parameters))
|
tecnicas/controllers/views_controller/session_management/details_escala_controller.py
CHANGED
|
@@ -22,29 +22,18 @@ from collections import defaultdict
|
|
| 22 |
|
| 23 |
|
| 24 |
class DetallesEscalasController(DetallesController):
|
| 25 |
-
url_template = "tecnicas/manage_sesions/detalles-sesion.html"
|
| 26 |
-
|
| 27 |
def __init__(self, session: SesionSensorial):
|
| 28 |
super().__init__(session)
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
context = self.getContext()
|
| 32 |
-
|
| 33 |
-
if error != "" or error:
|
| 34 |
-
context["error"] = error
|
| 35 |
-
if message != "" or message:
|
| 36 |
-
context["message"] = message
|
| 37 |
-
|
| 38 |
-
return render(
|
| 39 |
-
request, self.url_template, context)
|
| 40 |
|
| 41 |
def getContext(self):
|
|
|
|
|
|
|
| 42 |
self.context = {
|
| 43 |
-
"
|
|
|
|
| 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
|
|
@@ -94,35 +83,3 @@ class DetallesEscalasController(DetallesController):
|
|
| 94 |
self.context["fin_repeticiones"] = technique.repeticion >= technique.repeticiones_max
|
| 95 |
|
| 96 |
return self.context
|
| 97 |
-
|
| 98 |
-
def startRepetition(self, presenter: Presentador, request: HttpRequest):
|
| 99 |
-
creator = presenter
|
| 100 |
-
technique = self.session.tecnica
|
| 101 |
-
|
| 102 |
-
if creator.user.username != self.session.creadoPor.user.username:
|
| 103 |
-
return self.getResponse(error="Solo el presentador que crea la sesión puede iniciar la repetición", request=request)
|
| 104 |
-
elif self.session.activo:
|
| 105 |
-
return self.getResponse(error="La sesión ya está activada", request=request)
|
| 106 |
-
elif technique.repeticion >= technique.repeticiones_max:
|
| 107 |
-
return self.getResponse(error="Se ha alcanzado el número de repeticiones máxima", request=request)
|
| 108 |
-
|
| 109 |
-
there_participacions = Participacion.objects.filter(
|
| 110 |
-
tecnica=technique).exists()
|
| 111 |
-
|
| 112 |
-
if there_participacions:
|
| 113 |
-
(is_update_participations,
|
| 114 |
-
message) = ParticipacionController.outAllInSession(self.session)
|
| 115 |
-
if not is_update_participations:
|
| 116 |
-
return self.getResponse(error=message, request=request)
|
| 117 |
-
|
| 118 |
-
self.session.activo = True
|
| 119 |
-
technique.repeticion = technique.repeticion + 1
|
| 120 |
-
|
| 121 |
-
technique.save()
|
| 122 |
-
self.session.save()
|
| 123 |
-
|
| 124 |
-
parameters = {
|
| 125 |
-
"session_code": self.session.codigo_sesion
|
| 126 |
-
}
|
| 127 |
-
return redirect(
|
| 128 |
-
reverse("cata_system:monitor_sesion", kwargs=parameters))
|
|
|
|
| 22 |
|
| 23 |
|
| 24 |
class DetallesEscalasController(DetallesController):
|
|
|
|
|
|
|
| 25 |
def __init__(self, session: SesionSensorial):
|
| 26 |
super().__init__(session)
|
| 27 |
+
self.url_template = "tecnicas/manage_sesions/detalles-sesion.html"
|
| 28 |
+
self.url_next = "cata_system:monitor_sesion"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
def getContext(self):
|
| 31 |
+
technique = self.session.tecnica
|
| 32 |
+
|
| 33 |
self.context = {
|
| 34 |
+
"sesion": self.session,
|
| 35 |
+
"use_technique": technique
|
| 36 |
}
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
# Datos de la escala usada
|
| 39 |
scale: Escala = technique.escala_tecnica
|
|
|
|
| 83 |
self.context["fin_repeticiones"] = technique.repeticion >= technique.repeticiones_max
|
| 84 |
|
| 85 |
return self.context
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tecnicas/controllers/views_controller/session_management/details_rata_controller.py
CHANGED
|
@@ -10,47 +10,3 @@ from collections import defaultdict
|
|
| 10 |
class DetallesRATAController(DetallesController):
|
| 11 |
def __init__(self, session: SesionSensorial):
|
| 12 |
super().__init__(session)
|
| 13 |
-
|
| 14 |
-
def getResponse(self, request: HttpRequest, error: str = ""):
|
| 15 |
-
context = self.getContext()
|
| 16 |
-
if error != "" or error:
|
| 17 |
-
context["error"] = error
|
| 18 |
-
return render(
|
| 19 |
-
request, self.url_template, context)
|
| 20 |
-
|
| 21 |
-
def getContext(self):
|
| 22 |
-
self.context = {}
|
| 23 |
-
self.context["sesion"] = self.session
|
| 24 |
-
self.words = PalabrasController.getWordsInTechnique(
|
| 25 |
-
self.session.tecnica)
|
| 26 |
-
self.context["palabras"] = [word.nombre_palabra for word in self.words]
|
| 27 |
-
|
| 28 |
-
ratings_for_repetition = []
|
| 29 |
-
|
| 30 |
-
ratings = CalificacionController.getRatingsByTechnique(
|
| 31 |
-
technique=self.session.tecnica)
|
| 32 |
-
|
| 33 |
-
if isinstance(ratings, dict) or not ratings:
|
| 34 |
-
self.context["calificaciones"] = ratings_for_repetition
|
| 35 |
-
self.context["existen_calificaciones"] = False
|
| 36 |
-
return self.context
|
| 37 |
-
|
| 38 |
-
data = DatoController.getWordValuesForConvecional(
|
| 39 |
-
ratings=ratings, technique=self.session.tecnica)
|
| 40 |
-
|
| 41 |
-
ratings_for_repetition = defaultdict(
|
| 42 |
-
lambda: defaultdict(lambda: defaultdict(list)))
|
| 43 |
-
|
| 44 |
-
for item in data:
|
| 45 |
-
user = item["usuarioCatador"]
|
| 46 |
-
rep = item["repeticion"]
|
| 47 |
-
prod = item["producto_code"]
|
| 48 |
-
|
| 49 |
-
ratings_for_repetition[rep][user][prod].append({
|
| 50 |
-
"nombre_palabra": item["nombre_palabra"],
|
| 51 |
-
"dato_valor": item["dato_valor"]
|
| 52 |
-
})
|
| 53 |
-
|
| 54 |
-
self.context["calificaciones"] = defaultdict_to_dict(
|
| 55 |
-
ratings_for_repetition)
|
| 56 |
-
self.context["existen_calificaciones"] = True
|
|
|
|
| 10 |
class DetallesRATAController(DetallesController):
|
| 11 |
def __init__(self, session: SesionSensorial):
|
| 12 |
super().__init__(session)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tecnicas/templates/tecnicas/manage_sesions/detalles-sesion-cata.html
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'tecnicas/layouts/base.html' %}
|
| 2 |
+
{% load static %}
|
| 3 |
+
|
| 4 |
+
{% block title %}Detalles Sesion{% endblock %}
|
| 5 |
+
|
| 6 |
+
{% block content %}
|
| 7 |
+
<article class="cts-container-main">
|
| 8 |
+
<article class="cts-wrap-content relative max-w-4xl">
|
| 9 |
+
<header class="text-center flex-row max-sm:flex-col w-full flex justify-around items-center flex-wrap gap-10">
|
| 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 |
+
<a href="{% url 'cata_system:panel_sesiones' page=1 %}">
|
| 14 |
+
<button class="cts-btn-general cts-btn-error btn-push">
|
| 15 |
+
Volver a las Sesiones
|
| 16 |
+
</button>
|
| 17 |
+
</a>
|
| 18 |
+
</header>
|
| 19 |
+
|
| 20 |
+
{% if message %}
|
| 21 |
+
{% include "../components/error-message.html" with message=message %}
|
| 22 |
+
{% endif %}
|
| 23 |
+
{% if error %}
|
| 24 |
+
{% include "../components/error-message.html" with message=error %}
|
| 25 |
+
{% endif %}
|
| 26 |
+
|
| 27 |
+
<p class="text-black font-bold text-2xl border-b-2">
|
| 28 |
+
Información general
|
| 29 |
+
</p>
|
| 30 |
+
<article
|
| 31 |
+
class="text-black rounded-xl grid grid-cols-2 max-sm:grid-cols-1 gap-3 max-sm:gap-1 text-xl max-sm:text-base">
|
| 32 |
+
<section
|
| 33 |
+
class="col-span-2 max-sm:col-span-1 bg-surface-ligt flex flex-wrap items-center justify-center max-sm:justify-normal gap-x-2 p-4 rounded-2xl">
|
| 34 |
+
<p class="font-bold">
|
| 35 |
+
Código:
|
| 36 |
+
</p>
|
| 37 |
+
<p class="font-sans">
|
| 38 |
+
{{ sesion.codigo_sesion }}
|
| 39 |
+
</p>
|
| 40 |
+
</section>
|
| 41 |
+
|
| 42 |
+
<section
|
| 43 |
+
class="col-span-2 max-sm:col-span-1 bg-surface-card flex flex-wrap items-center justify-center max-sm:justify-normal gap-x-2 p-4 rounded-2xl">
|
| 44 |
+
<p class="font-bold">
|
| 45 |
+
Nombre:
|
| 46 |
+
</p>
|
| 47 |
+
<p class="antialiased">
|
| 48 |
+
{% if sesion.nombre_sesion %}
|
| 49 |
+
{{ sesion.nombre_sesion }}
|
| 50 |
+
{% else %}
|
| 51 |
+
Sin nombre
|
| 52 |
+
{% endif %}
|
| 53 |
+
</p>
|
| 54 |
+
</section>
|
| 55 |
+
|
| 56 |
+
<section
|
| 57 |
+
class="bg-surface-card flex flex-wrap items-center justify-center max-sm:justify-normal gap-x-2 p-4 rounded-2xl">
|
| 58 |
+
<p class="font-bold">
|
| 59 |
+
Fecha creación:
|
| 60 |
+
</p>
|
| 61 |
+
<p class="font-sans font-normal uppercase">
|
| 62 |
+
{{ sesion.fechaCreacion }}
|
| 63 |
+
</p>
|
| 64 |
+
</section>
|
| 65 |
+
|
| 66 |
+
<section
|
| 67 |
+
class="bg-surface-card flex flex-wrap items-center justify-center max-sm:justify-normal gap-x-2 p-4 rounded-2xl">
|
| 68 |
+
<p class="font-bold">
|
| 69 |
+
Estado:
|
| 70 |
+
</p>
|
| 71 |
+
<p class="font-sans text-lg max-sm:text-base font-normal">
|
| 72 |
+
{% if sesion.activo %}
|
| 73 |
+
En proceso
|
| 74 |
+
{% else %}
|
| 75 |
+
Listo para iniciar repetición
|
| 76 |
+
{% endif %}
|
| 77 |
+
</p>
|
| 78 |
+
</section>
|
| 79 |
+
|
| 80 |
+
<section
|
| 81 |
+
class="bg-surface-card flex flex-wrap items-center justify-center max-sm:justify-normal gap-x-2 p-4 rounded-2xl">
|
| 82 |
+
<p class="font-bold">
|
| 83 |
+
Estilo palabras:
|
| 84 |
+
</p>
|
| 85 |
+
<p class="font-sans text-lg max-sm:text-base font-normal uppercase">
|
| 86 |
+
{{ sesion.tecnica.id_estilo }}
|
| 87 |
+
</p>
|
| 88 |
+
</section>
|
| 89 |
+
|
| 90 |
+
<section
|
| 91 |
+
class="bg-surface-ligt flex flex-wrap items-center justify-center max-sm:justify-normal gap-x-2 p-4 rounded-2xl">
|
| 92 |
+
<p class="font-bold">
|
| 93 |
+
Técnica:
|
| 94 |
+
</p>
|
| 95 |
+
<p class="font-sans text-lg max-sm:text-base font-normal uppercase">
|
| 96 |
+
{{ sesion.tecnica.tipo_tecnica }}
|
| 97 |
+
</p>
|
| 98 |
+
</section>
|
| 99 |
+
|
| 100 |
+
<section
|
| 101 |
+
class="bg-surface-card flex flex-wrap items-center justify-center max-sm:justify-normal gap-x-2 p-4 rounded-2xl">
|
| 102 |
+
<p class="font-sans">
|
| 103 |
+
Pueden ingresar tantos catadores como se desee
|
| 104 |
+
</p>
|
| 105 |
+
</section>
|
| 106 |
+
|
| 107 |
+
<section
|
| 108 |
+
class="max-sm:col-span-1 bg-surface-card flex flex-wrap items-center justify-center max-sm:justify-normal gap-x-2 p-4 rounded-2xl">
|
| 109 |
+
<p class="font-sans">
|
| 110 |
+
La técnica usada solo puede realizarse una vez, hay una única repetición
|
| 111 |
+
</p>
|
| 112 |
+
</section>
|
| 113 |
+
|
| 114 |
+
<section
|
| 115 |
+
class="col-span-2 max-sm:col-span-1 bg-surface-card flex flex-wrap items-center justify-center max-sm:justify-normal gap-x-2 p-4 rounded-2xl">
|
| 116 |
+
<p class="font-bold">
|
| 117 |
+
Instrucciones:
|
| 118 |
+
</p>
|
| 119 |
+
<p class="font-sans text-xl max-sm:text-base font-normal">
|
| 120 |
+
{{ sesion.tecnica.instrucciones }}
|
| 121 |
+
</p>
|
| 122 |
+
</section>
|
| 123 |
+
</article>
|
| 124 |
+
|
| 125 |
+
<p class="text-black font-bold text-2xl border-b-2">
|
| 126 |
+
Palabras usadas para calificar
|
| 127 |
+
</p>
|
| 128 |
+
<article
|
| 129 |
+
class="text-white rounded-xl grid grid-cols-4 max-sm:grid-cols-1 gap-3 *:bg-surface-ligt *:flex *:items-center *:justify-center *:gap-x-2 *:p-4 *:rounded-2xl">
|
| 130 |
+
{% for palabra in palabras %}
|
| 131 |
+
<section>
|
| 132 |
+
<p class="block text-black text-xl antialiased font-medium">
|
| 133 |
+
{{ palabra }}
|
| 134 |
+
</p>
|
| 135 |
+
</section>
|
| 136 |
+
{% endfor %}
|
| 137 |
+
</article>
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
<p class="text-black font-bold text-2xl border-b-2">
|
| 141 |
+
Acciones disponibles
|
| 142 |
+
</p>
|
| 143 |
+
<article class="flex flex-wrap gap-10 max-sm:gap-2">
|
| 144 |
+
{% if not sesion.activo %}
|
| 145 |
+
{% if fin_repeticiones %}
|
| 146 |
+
<div
|
| 147 |
+
class="text-2xl font-semibold flex-1 cts-btn-secondary p-4 flex justify-center items-center rounded-lg select-none text-center">
|
| 148 |
+
<p class=" text-black">
|
| 149 |
+
Máximo número de repeticiones alcanzado
|
| 150 |
+
</p>
|
| 151 |
+
</div>
|
| 152 |
+
{% else %}
|
| 153 |
+
<button
|
| 154 |
+
class="ct-btn-start-repition flex-1 uppercase text-lg max-sm:text-base tracking-wider p-4 border-b-2 active:border-b-0 active:border-t-2 active:border-green-500 border-green-800 transition-all rounded-xl bg-green-600 text-white font-bold disabled:bg-amber-600 flex flex-col justify-center items-center gap-2"
|
| 155 |
+
onclick="startRepetition()">
|
| 156 |
+
Iniciar repetición
|
| 157 |
+
<figure class="w-10">
|
| 158 |
+
<img src="{% static 'img/giro.svg' %}" alt="flechas girando" class="invert">
|
| 159 |
+
</figure>
|
| 160 |
+
</button>
|
| 161 |
+
{% endif %}
|
| 162 |
+
{% else %}
|
| 163 |
+
<a href="{% url 'cata_system:monitor_sesion' session_code=sesion.codigo_sesion %}" class="flex-1 w-fit">
|
| 164 |
+
<button
|
| 165 |
+
class="ct-btn-start-repition w-full uppercase text-lg max-sm:text-base tracking-wider p-4 border-b-2 active:border-b-0 active:border-t-2 active:border-orange-500 border-orange-800 transition-all rounded-xl bg-orange-600 text-white font-bold disabled:bg-amber-600 flex flex-col justify-center items-center gap-2">
|
| 166 |
+
Monitorear repetición
|
| 167 |
+
<figure class="w-10">
|
| 168 |
+
<img src="{% static 'img/monitor.svg' %}" alt="flechas girando" class="invert">
|
| 169 |
+
</figure>
|
| 170 |
+
</button>
|
| 171 |
+
</a>
|
| 172 |
+
{% endif %}
|
| 173 |
+
<button
|
| 174 |
+
class="flex-1 uppercase text-lg cts-btn-general cts-btn-error btn-push flex flex-col justify-center items-center gap-2"
|
| 175 |
+
onclick="showWarningDialog('cts-warnig-dialog')">
|
| 176 |
+
borrar
|
| 177 |
+
<figure class="w-10">
|
| 178 |
+
<img src="{% static 'img/basura.svg' %}" alt="bote de basura" class="invert">
|
| 179 |
+
</figure>
|
| 180 |
+
</button>
|
| 181 |
+
</article>
|
| 182 |
+
|
| 183 |
+
<section
|
| 184 |
+
class="absolute w-full h-full flex justify-center items-center bg-surface-alter-card/70 top-0 left-0 p-6 rounded-xl cts-warnig-dialog hidden">
|
| 185 |
+
<article class="bg-surface-card p-4 space-y-6 rounded-xl">
|
| 186 |
+
<h2 class="text-4xl text-black text-center">
|
| 187 |
+
¡¡¡Cuidado!!!
|
| 188 |
+
</h2>
|
| 189 |
+
<p class="text-2xl text-black text-center">
|
| 190 |
+
Esta acción no es reversible, si la continua también borrara todos los datos recopilados
|
| 191 |
+
relacionados a esta sesión y no podrá volver a recuperarlos
|
| 192 |
+
</p>
|
| 193 |
+
<section class="text-black font-bold text-xl space-y-4">
|
| 194 |
+
<p class="text-center">
|
| 195 |
+
¿Estás seguro de continuar?
|
| 196 |
+
</p>
|
| 197 |
+
<div class="flex max-sm:flex-col gap-4 justify-center">
|
| 198 |
+
<button class="cts-btn-general cts-btn-error btn-push" onclick="deleteSession()">
|
| 199 |
+
Estoy seguro
|
| 200 |
+
</button>
|
| 201 |
+
<button class="cts-btn-general cts-btn-primary btn-push"
|
| 202 |
+
onclick="hiddenWarningDialog('cts-warnig-dialog')">
|
| 203 |
+
No, cancelar
|
| 204 |
+
</button>
|
| 205 |
+
</div>
|
| 206 |
+
</section>
|
| 207 |
+
</article>
|
| 208 |
+
</section>
|
| 209 |
+
|
| 210 |
+
<p class="text-black font-bold text-2xl border-b-2">
|
| 211 |
+
Datos obtenidos
|
| 212 |
+
</p>
|
| 213 |
+
|
| 214 |
+
<article class="bg-surface-card p-4 max-sm:px-2 text-black rounded">
|
| 215 |
+
<section class="text-xl space-y-4 space-x-4 mb-4">
|
| 216 |
+
<p class="inline italic underline font-semibold">
|
| 217 |
+
Los valores para este tipo de técnica son booleanos, pueden ser 1 o pueden ser 0
|
| 218 |
+
</p>
|
| 219 |
+
</section>
|
| 220 |
+
{% if existen_calificaciones %}
|
| 221 |
+
{% include "../components/table-convencional.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 %}
|
| 225 |
+
</article>
|
| 226 |
+
|
| 227 |
+
<form action="" method="post" class="form-action-session hidden">
|
| 228 |
+
<input type="hidden" name="action" class="action-option">
|
| 229 |
+
{% csrf_token %}
|
| 230 |
+
</form>
|
| 231 |
+
</article>
|
| 232 |
+
</article>
|
| 233 |
+
{% endblock %}
|
| 234 |
+
|
| 235 |
+
{% block extra_js %}
|
| 236 |
+
<script src="{% static 'js/details-session.js' %}"></script>
|
| 237 |
+
<script src="{% static 'js/showHiddenElement.js' %}"></script>
|
| 238 |
+
{% endblock %}
|
tecnicas/views/sessions_management/session_details.py
CHANGED
|
@@ -3,7 +3,7 @@ from django.shortcuts import redirect
|
|
| 3 |
from django.urls import reverse
|
| 4 |
from tecnicas.models import SesionSensorial
|
| 5 |
from tecnicas.utils import noValidTechnique
|
| 6 |
-
from
|
| 7 |
|
| 8 |
|
| 9 |
def sessionDetails(req: HttpRequest, session_code: str):
|
|
@@ -20,7 +20,12 @@ def sessionDetails(req: HttpRequest, session_code: str):
|
|
| 20 |
if use_techinique == "escalas" or use_techinique == "rata":
|
| 21 |
controller_view = DetallesEscalasController(
|
| 22 |
session=sensorial_session)
|
| 23 |
-
response = controller_view.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
request=req, message=message)
|
| 25 |
else:
|
| 26 |
response = noValidTechnique(
|
|
|
|
| 3 |
from django.urls import reverse
|
| 4 |
from tecnicas.models import SesionSensorial
|
| 5 |
from tecnicas.utils import noValidTechnique
|
| 6 |
+
from tecnicas.controllers import DetallesEscalasController, DetallesCATAController
|
| 7 |
|
| 8 |
|
| 9 |
def sessionDetails(req: HttpRequest, session_code: str):
|
|
|
|
| 20 |
if use_techinique == "escalas" or use_techinique == "rata":
|
| 21 |
controller_view = DetallesEscalasController(
|
| 22 |
session=sensorial_session)
|
| 23 |
+
response = controller_view.controllGetResponse(
|
| 24 |
+
request=req, message=message)
|
| 25 |
+
elif use_techinique == "cata":
|
| 26 |
+
controller_view = DetallesCATAController(
|
| 27 |
+
session=sensorial_session)
|
| 28 |
+
response = controller_view.controllGetResponse(
|
| 29 |
request=req, message=message)
|
| 30 |
else:
|
| 31 |
response = noValidTechnique(
|