Spaces:
Sleeping
Sleeping
Merge pull request #22 from CascoArcilla/HU10
Browse files- tecnicas/controllers/__init__.py +6 -2
- tecnicas/controllers/models_controller/calificacion_controller.py +3 -4
- tecnicas/controllers/models_controller/palabras_controller.py +2 -4
- tecnicas/controllers/models_controller/tecnica_controller.py +4 -4
- tecnicas/controllers/views_controller/create_session/panel_basic_controller.py +64 -1
- tecnicas/controllers/views_controller/create_session/panel_codes_controller.py +41 -1
- tecnicas/controllers/views_controller/create_session/panel_create_controller.py +121 -4
- tecnicas/controllers/views_controller/main_tester_form_controller.py +7 -5
- tecnicas/controllers/views_controller/session_management/details_controller.py +13 -0
- tecnicas/controllers/views_controller/{detalles_sesion_controller.py → session_management/details_escala_controller.py} +42 -38
- tecnicas/controllers/views_controller/session_management/details_rata_controller.py +56 -0
- tecnicas/controllers/views_controller/session_management/monitor_controller.py +10 -0
- tecnicas/controllers/views_controller/{monitor_sesion_controller.py → session_management/monitor_escalas_controller.py} +45 -34
- tecnicas/forms/codes_form.py +3 -2
- tecnicas/forms/sesion_basic_form.py +10 -1
- tecnicas/templates/tecnicas/create_sesion/configuracion-panel-basic.html +39 -11
- tecnicas/templates/tecnicas/create_sesion/configuracion-panel-codes.html +9 -0
- tecnicas/templates/tecnicas/main-panel.html +4 -0
- tecnicas/templates/tecnicas/manage_sesions/detalles-sesion.html +59 -27
- tecnicas/templates/tecnicas/manage_sesions/monitor-sesion.html +13 -9
- tecnicas/templates/tecnicas/manage_sesions/sesiones-panel.html +9 -5
- tecnicas/utils/__init__.py +1 -0
- tecnicas/utils/general_controllers.py +14 -0
- tecnicas/views/sessions_config/configuration_panel_basic.py +6 -1
- tecnicas/views/sessions_config/configuration_panel_codes.py +8 -3
- tecnicas/views/sessions_config/configuration_panel_tags.py +3 -3
- tecnicas/views/sessions_config/configuration_panel_words.py +3 -3
- tecnicas/views/sessions_config/create_session.py +4 -3
- tecnicas/views/sessions_management/session_details.py +51 -26
- tecnicas/views/sessions_management/session_monitor.py +45 -26
- tecnicas/views/sessions_management/sessions_panel.py +18 -13
- tecnicas/views/tester_forms/init_tester_form.py +16 -32
tecnicas/controllers/__init__.py
CHANGED
|
@@ -12,11 +12,9 @@ from .models_controller.posicion_controller import PosicionController
|
|
| 12 |
from .models_controller.particiapacion_controller import ParticipacionController
|
| 13 |
from .models_controller.dato_controller import DatoController
|
| 14 |
|
| 15 |
-
from .views_controller.detalles_sesion_controller import DetallesSesionController
|
| 16 |
from .views_controller.login_tester_controller import LoginTesterController
|
| 17 |
from .views_controller.main_tester_form_controller import MainTesterFormController
|
| 18 |
from .views_controller.api_rating_controller import ApiRatingController
|
| 19 |
-
from .views_controller.monitor_sesion_controller import MonitorSesionController
|
| 20 |
from .views_controller.tester_list_controller import TesterListController
|
| 21 |
from .views_controller.list_sessions_tester_controller import ListSessionsTesterController
|
| 22 |
|
|
@@ -25,3 +23,9 @@ from .views_controller.create_session.panel_tags_controller import PanelTagsCont
|
|
| 25 |
from .views_controller.create_session.panel_codes_controller import PanelCodesController
|
| 26 |
from .views_controller.create_session.panel_words_controller import PanelWordsController
|
| 27 |
from .views_controller.create_session.panel_create_controller import PanelCreateController
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
from .models_controller.particiapacion_controller import ParticipacionController
|
| 13 |
from .models_controller.dato_controller import DatoController
|
| 14 |
|
|
|
|
| 15 |
from .views_controller.login_tester_controller import LoginTesterController
|
| 16 |
from .views_controller.main_tester_form_controller import MainTesterFormController
|
| 17 |
from .views_controller.api_rating_controller import ApiRatingController
|
|
|
|
| 18 |
from .views_controller.tester_list_controller import TesterListController
|
| 19 |
from .views_controller.list_sessions_tester_controller import ListSessionsTesterController
|
| 20 |
|
|
|
|
| 23 |
from .views_controller.create_session.panel_codes_controller import PanelCodesController
|
| 24 |
from .views_controller.create_session.panel_words_controller import PanelWordsController
|
| 25 |
from .views_controller.create_session.panel_create_controller import PanelCreateController
|
| 26 |
+
|
| 27 |
+
from .views_controller.session_management.details_controller import DetallesController
|
| 28 |
+
from .views_controller.session_management.details_escala_controller import DetallesEscalasController
|
| 29 |
+
from .views_controller.session_management.details_rata_controller import DetallesRATAController
|
| 30 |
+
from .views_controller.session_management.monitor_controller import MonitorController
|
| 31 |
+
from .views_controller.session_management.monitor_escalas_controller import MonitorEscalasController
|
tecnicas/controllers/models_controller/calificacion_controller.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
| 1 |
from django.core.exceptions import ValidationError
|
| 2 |
-
from django.db import DatabaseError
|
| 3 |
from collections import defaultdict
|
| 4 |
-
from
|
| 5 |
-
from
|
| 6 |
|
| 7 |
|
| 8 |
class CalificacionController():
|
|
@@ -46,7 +45,7 @@ class CalificacionController():
|
|
| 46 |
repetition = technique.repeticion
|
| 47 |
|
| 48 |
if not repetition:
|
| 49 |
-
return
|
| 50 |
|
| 51 |
ratings = list(Calificacion.objects.filter(id_tecnica=technique))
|
| 52 |
|
|
|
|
| 1 |
from django.core.exceptions import ValidationError
|
|
|
|
| 2 |
from collections import defaultdict
|
| 3 |
+
from tecnicas.models import Calificacion, Tecnica, Posicion, Producto, Catador
|
| 4 |
+
from tecnicas.utils import controller_error, getId
|
| 5 |
|
| 6 |
|
| 7 |
class CalificacionController():
|
|
|
|
| 45 |
repetition = technique.repeticion
|
| 46 |
|
| 47 |
if not repetition:
|
| 48 |
+
return controller_error("Sin datos calificados aún")
|
| 49 |
|
| 50 |
ratings = list(Calificacion.objects.filter(id_tecnica=technique))
|
| 51 |
|
tecnicas/controllers/models_controller/palabras_controller.py
CHANGED
|
@@ -14,11 +14,9 @@ class PalabrasController():
|
|
| 14 |
self.ids_words = new_ids
|
| 15 |
|
| 16 |
def setWords(self):
|
| 17 |
-
self.words =
|
| 18 |
-
|
| 19 |
-
if not len(searched_words):
|
| 20 |
return controller_error("No se han encontrado registros")
|
| 21 |
-
self.words = searched_words
|
| 22 |
return self.words
|
| 23 |
|
| 24 |
@staticmethod
|
|
|
|
| 14 |
self.ids_words = new_ids
|
| 15 |
|
| 16 |
def setWords(self):
|
| 17 |
+
self.words = list(Palabra.objects.filter(id__in=self.ids_words))
|
| 18 |
+
if not len(self.words):
|
|
|
|
| 19 |
return controller_error("No se han encontrado registros")
|
|
|
|
| 20 |
return self.words
|
| 21 |
|
| 22 |
@staticmethod
|
tecnicas/controllers/models_controller/tecnica_controller.py
CHANGED
|
@@ -6,9 +6,9 @@ from tecnicas.utils import controller_error
|
|
| 6 |
class TecnicaController():
|
| 7 |
def setTechnique(self, **kwargs):
|
| 8 |
self.technique = Tecnica(
|
| 9 |
-
tipo_tecnica=kwargs["
|
| 10 |
-
id_estilo=kwargs["estilo_palabras"],
|
| 11 |
-
repeticiones_max=kwargs["numero_repeticiones"] or
|
| 12 |
limite_catadores=kwargs["numero_catadores"],
|
| 13 |
instrucciones=kwargs["instrucciones"],
|
| 14 |
)
|
|
@@ -17,7 +17,7 @@ class TecnicaController():
|
|
| 17 |
self.technique = Tecnica(
|
| 18 |
tipo_tecnica=TipoTecnica.objects.get(nombre_tecnica=basic["name_tecnica"]),
|
| 19 |
id_estilo=EstiloPalabra.objects.get(id=basic["estilo_palabras"]),
|
| 20 |
-
repeticiones_max=basic["numero_repeticiones"] or
|
| 21 |
limite_catadores=basic["numero_catadores"],
|
| 22 |
instrucciones=basic["instrucciones"] or "Espere instrucciones del Presentador",
|
| 23 |
)
|
|
|
|
| 6 |
class TecnicaController():
|
| 7 |
def setTechnique(self, **kwargs):
|
| 8 |
self.technique = Tecnica(
|
| 9 |
+
tipo_tecnica=TipoTecnica.objects.get(nombre_tecnica=kwargs["name_tecnica"]),
|
| 10 |
+
id_estilo=EstiloPalabra.objects.get(id=kwargs["estilo_palabras"]),
|
| 11 |
+
repeticiones_max=kwargs["numero_repeticiones"] or 1,
|
| 12 |
limite_catadores=kwargs["numero_catadores"],
|
| 13 |
instrucciones=kwargs["instrucciones"],
|
| 14 |
)
|
|
|
|
| 17 |
self.technique = Tecnica(
|
| 18 |
tipo_tecnica=TipoTecnica.objects.get(nombre_tecnica=basic["name_tecnica"]),
|
| 19 |
id_estilo=EstiloPalabra.objects.get(id=basic["estilo_palabras"]),
|
| 20 |
+
repeticiones_max=basic["numero_repeticiones"] or 1,
|
| 21 |
limite_catadores=basic["numero_catadores"],
|
| 22 |
instrucciones=basic["instrucciones"] or "Espere instrucciones del Presentador",
|
| 23 |
)
|
tecnicas/controllers/views_controller/create_session/panel_basic_controller.py
CHANGED
|
@@ -5,14 +5,25 @@ from django.urls import reverse
|
|
| 5 |
|
| 6 |
|
| 7 |
class PanelBasicController():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
def __init__(self):
|
| 9 |
pass
|
| 10 |
|
| 11 |
@staticmethod
|
| 12 |
def controllGetEscalas(request: HttpRequest):
|
| 13 |
form_sesion = SesionBasicForm()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
response = render(
|
| 15 |
-
request, "tecnicas/create_sesion/configuracion-panel-basic.html",
|
| 16 |
return response
|
| 17 |
|
| 18 |
@staticmethod
|
|
@@ -40,3 +51,55 @@ class PanelBasicController():
|
|
| 40 |
"cata_system:seleccion_tecnica") + "?error=error en datos de configuracion")
|
| 41 |
|
| 42 |
return response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
class PanelBasicController():
|
| 8 |
+
conf_initial_rata = {
|
| 9 |
+
"numero_catadores": 0,
|
| 10 |
+
"numero_repeticiones": 1
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
def __init__(self):
|
| 14 |
pass
|
| 15 |
|
| 16 |
@staticmethod
|
| 17 |
def controllGetEscalas(request: HttpRequest):
|
| 18 |
form_sesion = SesionBasicForm()
|
| 19 |
+
|
| 20 |
+
view_context = {
|
| 21 |
+
"form_sesion": form_sesion,
|
| 22 |
+
"use_technique": "escalas"
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
response = render(
|
| 26 |
+
request, "tecnicas/create_sesion/configuracion-panel-basic.html", view_context)
|
| 27 |
return response
|
| 28 |
|
| 29 |
@staticmethod
|
|
|
|
| 51 |
"cata_system:seleccion_tecnica") + "?error=error en datos de configuracion")
|
| 52 |
|
| 53 |
return response
|
| 54 |
+
|
| 55 |
+
@staticmethod
|
| 56 |
+
def controllGetRATA(request: HttpRequest):
|
| 57 |
+
form_sesion = SesionBasicForm(
|
| 58 |
+
initial_conf=PanelBasicController.conf_initial_rata)
|
| 59 |
+
|
| 60 |
+
view_context = {
|
| 61 |
+
"form_sesion": form_sesion,
|
| 62 |
+
"use_technique": "rata"
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
response = render(
|
| 66 |
+
request, "tecnicas/create_sesion/configuracion-panel-basic.html", view_context)
|
| 67 |
+
return response
|
| 68 |
+
|
| 69 |
+
@staticmethod
|
| 70 |
+
def controllPostRATA(request: HttpRequest, name_tecnica: str):
|
| 71 |
+
try:
|
| 72 |
+
form = SesionBasicForm(
|
| 73 |
+
request.POST, initial_conf=PanelBasicController.conf_initial_rata)
|
| 74 |
+
|
| 75 |
+
if form.is_valid():
|
| 76 |
+
values = {}
|
| 77 |
+
for name, value in form.cleaned_data.items():
|
| 78 |
+
if name == "estilo_palabras" or name == "tipo_escala":
|
| 79 |
+
values[name] = value.id
|
| 80 |
+
else:
|
| 81 |
+
values[name] = value
|
| 82 |
+
|
| 83 |
+
for key, expected in PanelBasicController.conf_initial_rata.items():
|
| 84 |
+
actual = values.get(key)
|
| 85 |
+
|
| 86 |
+
if actual is None or str(actual) != str(expected):
|
| 87 |
+
form.add_error(
|
| 88 |
+
key, f"Valor inválido para '{key}': se esperaba {expected}, se recibió {actual}")
|
| 89 |
+
|
| 90 |
+
if form.errors:
|
| 91 |
+
response = render(request, "tecnicas/create_sesion/configuracion-panel-basic.html", {
|
| 92 |
+
"form_sesion": form, "error": "No puedes modificar el número de catadores o repeticiones"})
|
| 93 |
+
else:
|
| 94 |
+
values["name_tecnica"] = name_tecnica
|
| 95 |
+
request.session['form_basic'] = values
|
| 96 |
+
response = redirect(
|
| 97 |
+
reverse("cata_system:panel_configuracion_tags"))
|
| 98 |
+
else:
|
| 99 |
+
response = render(request, "tecnicas/create_sesion/configuracion-panel-basic.html", {
|
| 100 |
+
"form_sesion": form, "error": "Información no valida"})
|
| 101 |
+
except KeyError:
|
| 102 |
+
response = redirect(reverse(
|
| 103 |
+
"cata_system:seleccion_tecnica") + "?error=error en datos de configuracion")
|
| 104 |
+
|
| 105 |
+
return response
|
tecnicas/controllers/views_controller/create_session/panel_codes_controller.py
CHANGED
|
@@ -23,7 +23,8 @@ class PanelCodesController():
|
|
| 23 |
|
| 24 |
context_codes_form = {
|
| 25 |
"form_codes": form_codes,
|
| 26 |
-
"num_tester": num_tester
|
|
|
|
| 27 |
}
|
| 28 |
|
| 29 |
return render(request, "tecnicas/create_sesion/configuracion-panel-codes.html", context_codes_form)
|
|
@@ -48,6 +49,7 @@ class PanelCodesController():
|
|
| 48 |
context_codes_form = {
|
| 49 |
"form_codes": form_codes,
|
| 50 |
"num_tester": num_tester,
|
|
|
|
| 51 |
}
|
| 52 |
|
| 53 |
if form_codes.is_valid():
|
|
@@ -64,6 +66,44 @@ class PanelCodesController():
|
|
| 64 |
|
| 65 |
return render(request, "tecnicas/create_sesion/configuracion-panel-codes.html", context_codes_form)
|
| 66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
@staticmethod
|
| 68 |
def defineInfoConvencional(data):
|
| 69 |
num_products = data["numero_productos"]
|
|
|
|
| 23 |
|
| 24 |
context_codes_form = {
|
| 25 |
"form_codes": form_codes,
|
| 26 |
+
"num_tester": num_tester,
|
| 27 |
+
"use_technique": "escalas"
|
| 28 |
}
|
| 29 |
|
| 30 |
return render(request, "tecnicas/create_sesion/configuracion-panel-codes.html", context_codes_form)
|
|
|
|
| 49 |
context_codes_form = {
|
| 50 |
"form_codes": form_codes,
|
| 51 |
"num_tester": num_tester,
|
| 52 |
+
"use_technique": "escalas"
|
| 53 |
}
|
| 54 |
|
| 55 |
if form_codes.is_valid():
|
|
|
|
| 66 |
|
| 67 |
return render(request, "tecnicas/create_sesion/configuracion-panel-codes.html", context_codes_form)
|
| 68 |
|
| 69 |
+
@staticmethod
|
| 70 |
+
def controllGetRATA(request: HttpRequest, data):
|
| 71 |
+
num_products = data["numero_productos"]
|
| 72 |
+
codes_products = generarCodigos(num_products)
|
| 73 |
+
form_codes = CodesForm(codes=codes_products)
|
| 74 |
+
|
| 75 |
+
context_codes_form = {
|
| 76 |
+
"form_codes": form_codes,
|
| 77 |
+
"num_tester": 0,
|
| 78 |
+
"use_technique": "rata"
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
return render(request, "tecnicas/create_sesion/configuracion-panel-codes.html", context_codes_form)
|
| 82 |
+
|
| 83 |
+
@staticmethod
|
| 84 |
+
def controllPostRATA(request: HttpRequest):
|
| 85 |
+
codes = []
|
| 86 |
+
context_codes_form = {}
|
| 87 |
+
|
| 88 |
+
for name, value in request.POST.items():
|
| 89 |
+
if name.__contains__("producto_"):
|
| 90 |
+
codes.append(value)
|
| 91 |
+
|
| 92 |
+
form_codes = CodesForm(request.POST, codes=codes)
|
| 93 |
+
|
| 94 |
+
context_codes_form = {
|
| 95 |
+
"form_codes": form_codes,
|
| 96 |
+
"use_technique": "rata"
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
if form_codes.is_valid():
|
| 100 |
+
request.session["form_codes"] = codes
|
| 101 |
+
return redirect(reverse("cata_system:panel_configuracion_words"))
|
| 102 |
+
else:
|
| 103 |
+
context_codes_form["error"] = "error en los datos recibidos"
|
| 104 |
+
|
| 105 |
+
return render(request, "tecnicas/create_sesion/configuracion-panel-codes.html", context_codes_form)
|
| 106 |
+
|
| 107 |
@staticmethod
|
| 108 |
def defineInfoConvencional(data):
|
| 109 |
num_products = data["numero_productos"]
|
tecnicas/controllers/views_controller/create_session/panel_create_controller.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from django.http import HttpRequest, JsonResponse
|
| 2 |
from django.db import transaction
|
|
|
|
| 3 |
from tecnicas.utils import general_error
|
| 4 |
from tecnicas.controllers import TecnicaController, EscalaController, ProductosController, OrdenesController, EstiloPalabrasController, PalabrasController, SesionController
|
| 5 |
from tecnicas.utils import deleteDataSession
|
|
@@ -10,8 +11,9 @@ class PanelCreateController():
|
|
| 10 |
pass
|
| 11 |
|
| 12 |
@staticmethod
|
| 13 |
-
def controllGetEscalas(request: HttpRequest
|
| 14 |
-
|
|
|
|
| 15 |
|
| 16 |
@staticmethod
|
| 17 |
def controllPostEscalas(request: HttpRequest):
|
|
@@ -29,7 +31,6 @@ class PanelCreateController():
|
|
| 29 |
data_basic = request.session["form_basic"]
|
| 30 |
controllerTechnique = TecnicaController()
|
| 31 |
controllerTechnique.setTechniqueFromBasicData(basic=data_basic)
|
| 32 |
-
|
| 33 |
technique = controllerTechnique.saveTechnique()
|
| 34 |
if not technique:
|
| 35 |
return general_error("Error al guardar la técnica")
|
|
@@ -147,7 +148,7 @@ class PanelCreateController():
|
|
| 147 |
|
| 148 |
# ////////////////////////////////// #
|
| 149 |
#
|
| 150 |
-
# Final step: Delete date
|
| 151 |
#
|
| 152 |
# ////////////////////////////////// #
|
| 153 |
|
|
@@ -155,3 +156,119 @@ class PanelCreateController():
|
|
| 155 |
return JsonResponse(context)
|
| 156 |
else:
|
| 157 |
return general_error("No se ha establecido acción")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from django.http import HttpRequest, JsonResponse
|
| 2 |
from django.db import transaction
|
| 3 |
+
from django.shortcuts import render
|
| 4 |
from tecnicas.utils import general_error
|
| 5 |
from tecnicas.controllers import TecnicaController, EscalaController, ProductosController, OrdenesController, EstiloPalabrasController, PalabrasController, SesionController
|
| 6 |
from tecnicas.utils import deleteDataSession
|
|
|
|
| 11 |
pass
|
| 12 |
|
| 13 |
@staticmethod
|
| 14 |
+
def controllGetEscalas(request: HttpRequest):
|
| 15 |
+
return render(
|
| 16 |
+
request, 'tecnicas/create_sesion/creando_sesion.html')
|
| 17 |
|
| 18 |
@staticmethod
|
| 19 |
def controllPostEscalas(request: HttpRequest):
|
|
|
|
| 31 |
data_basic = request.session["form_basic"]
|
| 32 |
controllerTechnique = TecnicaController()
|
| 33 |
controllerTechnique.setTechniqueFromBasicData(basic=data_basic)
|
|
|
|
| 34 |
technique = controllerTechnique.saveTechnique()
|
| 35 |
if not technique:
|
| 36 |
return general_error("Error al guardar la técnica")
|
|
|
|
| 148 |
|
| 149 |
# ////////////////////////////////// #
|
| 150 |
#
|
| 151 |
+
# Final step: Delete date in session #
|
| 152 |
#
|
| 153 |
# ////////////////////////////////// #
|
| 154 |
|
|
|
|
| 156 |
return JsonResponse(context)
|
| 157 |
else:
|
| 158 |
return general_error("No se ha establecido acción")
|
| 159 |
+
|
| 160 |
+
@staticmethod
|
| 161 |
+
def controllPostRATA(request: HttpRequest):
|
| 162 |
+
if request.POST.get('action') == 'create_session':
|
| 163 |
+
if not request.session.get("form_tags") or not request.session.get("form_codes") or not request.session.get("form_words"):
|
| 164 |
+
deleteDataSession(request)
|
| 165 |
+
return general_error("No se ha especificado información necesaria para la creación de la sesión, por favor, vuelve a intentarlo")
|
| 166 |
+
|
| 167 |
+
with transaction.atomic():
|
| 168 |
+
# ////////////////////////////////////////////////////// #
|
| 169 |
+
#
|
| 170 |
+
# First step: Create technique and scale with their tags #
|
| 171 |
+
#
|
| 172 |
+
# ////////////////////////////////////////////////////// #
|
| 173 |
+
data_basic = request.session["form_basic"]
|
| 174 |
+
data_basic["numero_catadores"] = 0
|
| 175 |
+
data_basic["numero_repeticiones"] = 1
|
| 176 |
+
controllerTechnique = TecnicaController()
|
| 177 |
+
controllerTechnique.setTechniqueFromBasicData(basic=data_basic)
|
| 178 |
+
technique = controllerTechnique.saveTechnique()
|
| 179 |
+
if not technique:
|
| 180 |
+
return general_error("Error al guardar la técnica")
|
| 181 |
+
|
| 182 |
+
data_scale = {
|
| 183 |
+
"id_scale": data_basic["tipo_escala"],
|
| 184 |
+
"size": data_basic["tamano_escala"],
|
| 185 |
+
"technique": technique
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
controllerScale = EscalaController(data=data_scale)
|
| 189 |
+
|
| 190 |
+
scale = controllerScale.saveScale()
|
| 191 |
+
if isinstance(scale, dict):
|
| 192 |
+
return general_error(scale["error"])
|
| 193 |
+
|
| 194 |
+
dict_tags = request.session["form_tags"]
|
| 195 |
+
saved_related_tags = controllerScale.realteTags(dict_tags)
|
| 196 |
+
if "error" in saved_related_tags:
|
| 197 |
+
return general_error(saved_related_tags["error"])
|
| 198 |
+
|
| 199 |
+
# ////////////////////////////////////////////// #
|
| 200 |
+
#
|
| 201 |
+
# Second step: Create productos with their codes #
|
| 202 |
+
#
|
| 203 |
+
# ////////////////////////////////////////////// #
|
| 204 |
+
codes = request.session["form_codes"]
|
| 205 |
+
|
| 206 |
+
controllerProducts = ProductosController(
|
| 207 |
+
codes=codes,
|
| 208 |
+
technique=technique
|
| 209 |
+
)
|
| 210 |
+
|
| 211 |
+
controllerProducts.setProductsNoSave()
|
| 212 |
+
saved_prodcuts = controllerProducts.saveProducts()
|
| 213 |
+
if isinstance(saved_prodcuts, dict):
|
| 214 |
+
return general_error(saved_prodcuts["error"])
|
| 215 |
+
|
| 216 |
+
# /////////////////////////////////////////////////////// #
|
| 217 |
+
#
|
| 218 |
+
# Third step: Create relations technique with Words Style #
|
| 219 |
+
#
|
| 220 |
+
# /////////////////////////////////////////////////////// #
|
| 221 |
+
ids_words = request.session["form_words"]
|
| 222 |
+
words_controller = PalabrasController(ids=ids_words)
|
| 223 |
+
|
| 224 |
+
words_to_use = words_controller.setWords()
|
| 225 |
+
if isinstance(words_to_use, dict):
|
| 226 |
+
return general_error(words_to_use["error"])
|
| 227 |
+
|
| 228 |
+
style_controller = EstiloPalabrasController(
|
| 229 |
+
technique=technique, words=words_to_use)
|
| 230 |
+
|
| 231 |
+
instace_style = style_controller.createAndSaveInstaceStyle()
|
| 232 |
+
if isinstance(instace_style, dict):
|
| 233 |
+
return general_error(instace_style["error"])
|
| 234 |
+
|
| 235 |
+
words_using = style_controller.relatedWords()
|
| 236 |
+
if isinstance(words_using, dict):
|
| 237 |
+
return general_error(words_using["error"])
|
| 238 |
+
|
| 239 |
+
# //////////////////////////////////////////////////////// #
|
| 240 |
+
#
|
| 241 |
+
# Fourth step: Create session and relat with the technique #
|
| 242 |
+
#
|
| 243 |
+
# //////////////////////////////////////////////////////// #
|
| 244 |
+
session_controller = SesionController(
|
| 245 |
+
name_session=data_basic["nombre_sesion"] if data_basic["nombre_sesion"] != "" else None,
|
| 246 |
+
technique=technique,
|
| 247 |
+
creator=request.user.user_presentador
|
| 248 |
+
)
|
| 249 |
+
|
| 250 |
+
setting_session = session_controller.setSession()
|
| 251 |
+
if isinstance(setting_session, dict):
|
| 252 |
+
return general_error(setting_session["error"])
|
| 253 |
+
|
| 254 |
+
saved_session = session_controller.saveSession()
|
| 255 |
+
if isinstance(saved_session, dict):
|
| 256 |
+
return general_error(saved_session["error"])
|
| 257 |
+
|
| 258 |
+
context = {
|
| 259 |
+
"message": "sesión creada",
|
| 260 |
+
"data": {
|
| 261 |
+
"codigo_sesion": saved_session.codigo_sesion,
|
| 262 |
+
"nombre_sesion": saved_session.nombre_sesion
|
| 263 |
+
}
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
# ////////////////////////////////// #
|
| 267 |
+
#
|
| 268 |
+
# Final step: Delete date en session #
|
| 269 |
+
#
|
| 270 |
+
# ////////////////////////////////// #
|
| 271 |
+
deleteDataSession(request)
|
| 272 |
+
return JsonResponse(context)
|
| 273 |
+
else:
|
| 274 |
+
return general_error("No se ha establecido acción")
|
tecnicas/controllers/views_controller/main_tester_form_controller.py
CHANGED
|
@@ -20,7 +20,7 @@ class MainTesterFormController():
|
|
| 20 |
with transaction.atomic():
|
| 21 |
orders_without_tester = list(Orden.objects.select_for_update().filter(
|
| 22 |
id_tecnica=self.session.tecnica, id_catador=None))
|
| 23 |
-
|
| 24 |
print(orders_without_tester)
|
| 25 |
|
| 26 |
if not orders_without_tester:
|
|
@@ -34,13 +34,15 @@ class MainTesterFormController():
|
|
| 34 |
|
| 35 |
return self.order_to_assign
|
| 36 |
|
| 37 |
-
def
|
| 38 |
try:
|
| 39 |
-
self.
|
| 40 |
id_tecnica=self.session.tecnica, id_catador=self.tester)
|
| 41 |
-
return self.order
|
| 42 |
except Orden.DoesNotExist:
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
def isEndedSession(self, repetition: int):
|
| 46 |
try:
|
|
|
|
| 20 |
with transaction.atomic():
|
| 21 |
orders_without_tester = list(Orden.objects.select_for_update().filter(
|
| 22 |
id_tecnica=self.session.tecnica, id_catador=None))
|
| 23 |
+
|
| 24 |
print(orders_without_tester)
|
| 25 |
|
| 26 |
if not orders_without_tester:
|
|
|
|
| 34 |
|
| 35 |
return self.order_to_assign
|
| 36 |
|
| 37 |
+
def checkAndAssignOrder(self):
|
| 38 |
try:
|
| 39 |
+
self.order_to_assign = Orden.objects.get(
|
| 40 |
id_tecnica=self.session.tecnica, id_catador=self.tester)
|
|
|
|
| 41 |
except Orden.DoesNotExist:
|
| 42 |
+
create = self.assignOrder()
|
| 43 |
+
if isinstance(create, dict):
|
| 44 |
+
return create
|
| 45 |
+
return self.order_to_assign
|
| 46 |
|
| 47 |
def isEndedSession(self, repetition: int):
|
| 48 |
try:
|
tecnicas/controllers/views_controller/session_management/details_controller.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from tecnicas.models import SesionSensorial, Presentador, Tecnica
|
| 2 |
+
from tecnicas.utils import controller_error
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class DetallesController():
|
| 6 |
+
url_template = "tecnicas/manage_sesions/detalles-sesion.html"
|
| 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()
|
tecnicas/controllers/views_controller/{detalles_sesion_controller.py → session_management/details_escala_controller.py}
RENAMED
|
@@ -11,29 +11,42 @@ Encabezados de como deben de aparecer los datos juntos
|
|
| 11 |
| Repeticion | Codigo Producto | Catador | P1 | P2 | P3 | Pn |
|
| 12 |
|
| 13 |
'''
|
| 14 |
-
|
| 15 |
-
from
|
| 16 |
-
from
|
| 17 |
-
from
|
|
|
|
|
|
|
|
|
|
| 18 |
from collections import defaultdict
|
| 19 |
-
from tecnicas.controllers import DatoController
|
| 20 |
-
from tecnicas.utils import defaultdict_to_dict
|
| 21 |
|
| 22 |
|
| 23 |
-
class
|
| 24 |
-
|
| 25 |
-
self.session = SesionSensorial.objects.get(codigo_sesion=session_code)
|
| 26 |
|
| 27 |
-
def
|
| 28 |
-
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
self.words = PalabrasController.getWordsInTechnique(
|
| 33 |
self.session.tecnica)
|
| 34 |
self.context["palabras"] = [word.nombre_palabra for word in self.words]
|
| 35 |
|
| 36 |
-
def getContextWithData(self):
|
| 37 |
ratings_for_repetition = []
|
| 38 |
|
| 39 |
ratings = CalificacionController.getRatingsByTechnique(
|
|
@@ -66,34 +79,25 @@ class DetallesSesionController():
|
|
| 66 |
|
| 67 |
return self.context
|
| 68 |
|
| 69 |
-
def
|
| 70 |
-
|
| 71 |
-
technique.
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
session = SesionSensorial.objects.get(codigo_sesion=session_code)
|
| 78 |
-
technique = Tecnica.objects.get(id=session.tecnica.id)
|
| 79 |
-
except Presentador.DoesNotExist:
|
| 80 |
-
return controller_error("no existe presentador")
|
| 81 |
-
except SesionSensorial.DoesNotExist:
|
| 82 |
-
return controller_error("no existe sesión sensorial")
|
| 83 |
-
except Tecnica.DoesNotExist:
|
| 84 |
-
return controller_error("Ha ocurrido un error al recuperar la técnica")
|
| 85 |
-
|
| 86 |
-
if creator.user.username != session.creadoPor.user.username:
|
| 87 |
-
return controller_error("solo el presentador que crea la sesión puede iniciar la repetición")
|
| 88 |
-
elif session.activo:
|
| 89 |
-
return controller_error("la sesión ya está activada")
|
| 90 |
elif technique.repeticion == technique.repeticiones_max:
|
| 91 |
-
return
|
| 92 |
|
| 93 |
-
session.activo = True
|
| 94 |
technique.repeticion = technique.repeticion + 1
|
| 95 |
|
| 96 |
technique.save()
|
| 97 |
-
session.save()
|
| 98 |
|
| 99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
| Repeticion | Codigo Producto | Catador | P1 | P2 | P3 | Pn |
|
| 12 |
|
| 13 |
'''
|
| 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, Tecnica
|
| 18 |
+
from tecnicas.controllers import DatoController, CalificacionController, PalabrasController
|
| 19 |
+
from .details_controller import DetallesController
|
| 20 |
+
from tecnicas.utils import defaultdict_to_dict, controller_error
|
| 21 |
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 |
+
def getResponse(self, request: HttpRequest, error: str = "", message: str = ""):
|
| 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 |
+
"use_technique": self.session.tecnica.tipo_tecnica.nombre_tecnica
|
| 44 |
+
}
|
| 45 |
+
self.context["sesion"] = self.session
|
| 46 |
self.words = PalabrasController.getWordsInTechnique(
|
| 47 |
self.session.tecnica)
|
| 48 |
self.context["palabras"] = [word.nombre_palabra for word in self.words]
|
| 49 |
|
|
|
|
| 50 |
ratings_for_repetition = []
|
| 51 |
|
| 52 |
ratings = CalificacionController.getRatingsByTechnique(
|
|
|
|
| 79 |
|
| 80 |
return self.context
|
| 81 |
|
| 82 |
+
def startRepetition(self, presenter: Presentador):
|
| 83 |
+
creator = presenter
|
| 84 |
+
technique = self.session.tecnica
|
| 85 |
+
|
| 86 |
+
if creator.user.username != self.session.creadoPor.user.username:
|
| 87 |
+
return self.getResponse(error="Solo el presentador que crea la sesión puede iniciar la repetición")
|
| 88 |
+
elif self.session.activo:
|
| 89 |
+
return self.getResponse(error="La sesión ya está activada")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
elif technique.repeticion == technique.repeticiones_max:
|
| 91 |
+
return self.getResponse(error="Se ha alcanzado el número de repeticiones máxima")
|
| 92 |
|
| 93 |
+
self.session.activo = True
|
| 94 |
technique.repeticion = technique.repeticion + 1
|
| 95 |
|
| 96 |
technique.save()
|
| 97 |
+
self.session.save()
|
| 98 |
|
| 99 |
+
parameters = {
|
| 100 |
+
"session_code": self.session.codigo_sesion
|
| 101 |
+
}
|
| 102 |
+
return redirect(
|
| 103 |
+
reverse("cata_system:monitor_sesion", kwargs=parameters))
|
tecnicas/controllers/views_controller/session_management/details_rata_controller.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 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
|
tecnicas/controllers/views_controller/session_management/monitor_controller.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from tecnicas.models import SesionSensorial
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class MonitorController():
|
| 5 |
+
def __init__(self, session: SesionSensorial):
|
| 6 |
+
self.sensorial_session = session
|
| 7 |
+
|
| 8 |
+
def updataSession(self):
|
| 9 |
+
self.sensorial_session = SesionSensorial.objects.get(
|
| 10 |
+
codigo_sesion=self.sensorial_session.codigo_sesion)
|
tecnicas/controllers/views_controller/{monitor_sesion_controller.py → session_management/monitor_escalas_controller.py}
RENAMED
|
@@ -1,61 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from tecnicas.models import SesionSensorial, EsAtributo, EsVocabulario, Producto, Calificacion
|
| 2 |
from tecnicas.controllers import ParticipacionController, SesionController
|
| 3 |
from tecnicas.utils import controller_error
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
-
class
|
| 7 |
-
|
| 8 |
-
self.code_session = session_code
|
| 9 |
|
| 10 |
-
def
|
| 11 |
-
|
| 12 |
-
codigo_sesion=self.code_session)
|
| 13 |
|
| 14 |
-
def
|
| 15 |
-
|
| 16 |
-
self.sensorial_session = SesionSensorial.objects.select_related(
|
| 17 |
-
"tecnica"
|
| 18 |
-
).only(
|
| 19 |
-
"nombre_sesion",
|
| 20 |
-
"tecnica__limite_catadores",
|
| 21 |
-
).get(codigo_sesion=self.code_session)
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
"session_name": self.sensorial_session.nombre_sesion,
|
| 30 |
"max_testers": self.sensorial_session.tecnica.limite_catadores,
|
| 31 |
"current_testers": len(self.participations),
|
| 32 |
"active_testers": len([part for part in self.participations if part.activo]),
|
| 33 |
-
"participations": self.participations
|
|
|
|
| 34 |
}
|
| 35 |
|
| 36 |
-
return context
|
| 37 |
-
|
| 38 |
def getExpectedRatings(self):
|
| 39 |
num_products = Producto.objects.filter(
|
| 40 |
-
id_tecnica=self.
|
| 41 |
-
|
| 42 |
-
style_words = self.session.tecnica.id_estilo
|
| 43 |
-
|
| 44 |
num_words: int
|
| 45 |
|
| 46 |
if style_words.nombre_estilo == "atributos":
|
| 47 |
num_words = EsAtributo.objects.get(
|
| 48 |
-
id_tecnica=self.
|
| 49 |
elif style_words.nombre_estilo == "vocabulario":
|
| 50 |
num_words = EsVocabulario.objects.get(
|
| 51 |
-
id_tecnica=self.
|
| 52 |
|
| 53 |
return num_products * num_words
|
| 54 |
|
| 55 |
def checkAllParticipantsEnded(self):
|
| 56 |
-
self.
|
| 57 |
-
|
| 58 |
-
technique = self.session.tecnica
|
| 59 |
|
| 60 |
expected_ratings_repetition = self.getExpectedRatings()
|
| 61 |
|
|
@@ -75,8 +86,8 @@ class MonitorSesionController():
|
|
| 75 |
return (True, "Puedes finalizar la sesión")
|
| 76 |
|
| 77 |
def finishSession(self):
|
| 78 |
-
response = SesionController.finishRepetion(self.
|
| 79 |
if isinstance(response, dict):
|
| 80 |
return controller_error(response["error"])
|
| 81 |
-
self.
|
| 82 |
-
return self.
|
|
|
|
| 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, EsAtributo, EsVocabulario, Producto, Calificacion
|
| 5 |
from tecnicas.controllers import ParticipacionController, SesionController
|
| 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 controlGetResponse(self, request: HttpRequest, error: str = "", message: str = ""):
|
| 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.checkAllParticipantsEnded()
|
| 29 |
+
if not is_all_end:
|
| 30 |
+
self.context["error"] = message
|
| 31 |
+
return render(request, "tecnicas/manage_sesions/monitor-sesion.html", self.context)
|
| 32 |
+
response = self.finishSession()
|
| 33 |
+
if isinstance(response, dict):
|
| 34 |
+
self.context["error"] = response["error"]
|
| 35 |
+
return render(request, "tecnicas/manage_sesions/monitor-sesion.html", self.context)
|
| 36 |
+
self.context["message"] = message
|
| 37 |
+
return redirect(reverse("cata_system:detalles_sesion", kwargs={"session_code": self.sensorial_session.codigo_sesion}))
|
| 38 |
+
|
| 39 |
+
def setContext(self):
|
| 40 |
+
self.participations = ParticipacionController.getParticipationsInTechinique(
|
| 41 |
+
self.sensorial_session.tecnica)
|
| 42 |
+
|
| 43 |
+
self.context = {
|
| 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.getExpectedRatings()
|
| 72 |
|
|
|
|
| 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.updataSession()
|
| 93 |
+
return self.sensorial_session
|
tecnicas/forms/codes_form.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
| 1 |
from django import forms
|
| 2 |
|
|
|
|
| 3 |
class CodesForm(forms.Form):
|
| 4 |
-
def __init__(self, *args, codes
|
| 5 |
super().__init__(*args, **kwargs)
|
| 6 |
|
| 7 |
for index, code in enumerate(codes):
|
| 8 |
self.fields[f'producto_{index+1}'] = forms.CharField(max_length=3, required=True, min_length=3, initial=code, label=f"codigo {index+1}", widget=forms.TextInput(attrs={
|
| 9 |
"class": "ct-code bg-surface-ligt p-1 border-b-1 text-center w-full disabled:bg-surface-general uppercase"
|
| 10 |
-
}))
|
|
|
|
| 1 |
from django import forms
|
| 2 |
|
| 3 |
+
|
| 4 |
class CodesForm(forms.Form):
|
| 5 |
+
def __init__(self, *args, codes=[], **kwargs):
|
| 6 |
super().__init__(*args, **kwargs)
|
| 7 |
|
| 8 |
for index, code in enumerate(codes):
|
| 9 |
self.fields[f'producto_{index+1}'] = forms.CharField(max_length=3, required=True, min_length=3, initial=code, label=f"codigo {index+1}", widget=forms.TextInput(attrs={
|
| 10 |
"class": "ct-code bg-surface-ligt p-1 border-b-1 text-center w-full disabled:bg-surface-general uppercase"
|
| 11 |
+
}))
|
tecnicas/forms/sesion_basic_form.py
CHANGED
|
@@ -34,9 +34,12 @@ class SesionBasicForm(forms.Form):
|
|
| 34 |
"placeholder": "Este campo es opcional"
|
| 35 |
}), required=False)
|
| 36 |
|
| 37 |
-
def __init__(self, *args, **kwargs):
|
| 38 |
super().__init__(*args, **kwargs)
|
| 39 |
|
|
|
|
|
|
|
|
|
|
| 40 |
self.fields['estilo_palabras'] = forms.ModelChoiceField(queryset=EstiloPalabra.objects.all(), widget=forms.RadioSelect(attrs={
|
| 41 |
"class": "uppercase text-lg tracking-wider font-medium p-2 px-4 active:px-5 transition-all rounded-xl bg-blue-500 text-white",
|
| 42 |
}), required=True, initial=EstiloPalabra.objects.first())
|
|
@@ -49,6 +52,12 @@ class SesionBasicForm(forms.Form):
|
|
| 49 |
"class": "cts-size-input",
|
| 50 |
}), required=True)
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
def clean(self):
|
| 53 |
data_clean = super().clean()
|
| 54 |
escala = data_clean.get("tipo_escala")
|
|
|
|
| 34 |
"placeholder": "Este campo es opcional"
|
| 35 |
}), required=False)
|
| 36 |
|
| 37 |
+
def __init__(self, *args, initial_conf: dict = None, **kwargs):
|
| 38 |
super().__init__(*args, **kwargs)
|
| 39 |
|
| 40 |
+
if initial_conf is None:
|
| 41 |
+
initial_conf = {}
|
| 42 |
+
|
| 43 |
self.fields['estilo_palabras'] = forms.ModelChoiceField(queryset=EstiloPalabra.objects.all(), widget=forms.RadioSelect(attrs={
|
| 44 |
"class": "uppercase text-lg tracking-wider font-medium p-2 px-4 active:px-5 transition-all rounded-xl bg-blue-500 text-white",
|
| 45 |
}), required=True, initial=EstiloPalabra.objects.first())
|
|
|
|
| 52 |
"class": "cts-size-input",
|
| 53 |
}), required=True)
|
| 54 |
|
| 55 |
+
if "numero_catadores" in initial_conf:
|
| 56 |
+
self.fields["numero_catadores"].initial = initial_conf["numero_catadores"]
|
| 57 |
+
|
| 58 |
+
if "numero_repeticiones" in initial_conf:
|
| 59 |
+
self.fields["numero_repeticiones"].initial = initial_conf["numero_repeticiones"]
|
| 60 |
+
|
| 61 |
def clean(self):
|
| 62 |
data_clean = super().clean()
|
| 63 |
escala = data_clean.get("tipo_escala")
|
tecnicas/templates/tecnicas/create_sesion/configuracion-panel-basic.html
CHANGED
|
@@ -26,20 +26,45 @@
|
|
| 26 |
{{ form_sesion.nombre_sesion }}
|
| 27 |
</label>
|
| 28 |
</section>
|
| 29 |
-
<section
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
<p
|
|
|
|
|
|
|
| 33 |
{{ form_sesion.numero_productos }}
|
| 34 |
</label>
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
{{ form_sesion.numero_catadores }}
|
| 38 |
</label>
|
| 39 |
-
<label for="{{ form_sesion.numero_repeticiones.id_for_label }}"
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
{{ form_sesion.numero_repeticiones }}
|
| 42 |
</label>
|
|
|
|
| 43 |
</section>
|
| 44 |
<section class="flex justify-center items-center mt-2">
|
| 45 |
<label for="{{form_sesion.instrucciones.id_for_label}}"
|
|
@@ -95,15 +120,18 @@
|
|
| 95 |
</label>
|
| 96 |
<div class="flex justify-around max-sm:flex-col gap-8 cts-options-size-scale">
|
| 97 |
<label class="flex flex-col items-center cursor-pointer">
|
| 98 |
-
<input type="radio" name="option_size_scale" value="5"
|
|
|
|
| 99 |
<span class="mt-2 text-xl text-gray-700 font-medium">5</span>
|
| 100 |
</label>
|
| 101 |
<label class="flex flex-col items-center cursor-pointer">
|
| 102 |
-
<input type="radio" name="option_size_scale" value="7"
|
|
|
|
| 103 |
<span class="mt-2 text-xl text-gray-700 font-medium">7</span>
|
| 104 |
</label>
|
| 105 |
<label class="flex flex-col items-center cursor-pointer">
|
| 106 |
-
<input type="radio" name="option_size_scale" value="9"
|
|
|
|
| 107 |
<span class="mt-2 text-xl text-gray-700 font-medium">9</span>
|
| 108 |
</label>
|
| 109 |
</div>
|
|
|
|
| 26 |
{{ form_sesion.nombre_sesion }}
|
| 27 |
</label>
|
| 28 |
</section>
|
| 29 |
+
<section class="flex flex-row flex-wrap justify-center gap-4">
|
| 30 |
+
<label for="{{ form_sesion.numero_productos.id_for_label }}"
|
| 31 |
+
class="text-lg flex flex-col items-center px-2 font-medium tracking-wide">
|
| 32 |
+
<p class="tracking-normal text-base font-bold">
|
| 33 |
+
Número de Productos:
|
| 34 |
+
</p>
|
| 35 |
{{ form_sesion.numero_productos }}
|
| 36 |
</label>
|
| 37 |
+
{% if use_technique == 'escalas' %}
|
| 38 |
+
<label for="{{ form_sesion.numero_catadores.id_for_label }}"
|
| 39 |
+
class="text-lg flex flex-col items-center px-2 font-medium tracking-wide">
|
| 40 |
+
<p class="tracking-normal text-base font-bold">
|
| 41 |
+
Número de Catadores:
|
| 42 |
+
</p>
|
| 43 |
{{ form_sesion.numero_catadores }}
|
| 44 |
</label>
|
| 45 |
+
<label for="{{ form_sesion.numero_repeticiones.id_for_label }}"
|
| 46 |
+
class="text-lg flex flex-col items-center px-2 font-medium tracking-wide">
|
| 47 |
+
<p class="tracking-normal text-base font-bold">
|
| 48 |
+
Número de Repeticiones:
|
| 49 |
+
</p>
|
| 50 |
+
{{ form_sesion.numero_repeticiones }}
|
| 51 |
+
</label>
|
| 52 |
+
{% else %}
|
| 53 |
+
<label for="{{ form_sesion.numero_catadores.id_for_label }}"
|
| 54 |
+
class="text-lg flex flex-col items-center px-2 font-medium tracking-wide hidden">
|
| 55 |
+
<p class="tracking-normal text-base font-bold">
|
| 56 |
+
Número de Catadores:
|
| 57 |
+
</p>
|
| 58 |
+
{{ form_sesion.numero_catadores }}
|
| 59 |
+
</label>
|
| 60 |
+
<label for="{{ form_sesion.numero_repeticiones.id_for_label }}"
|
| 61 |
+
class="text-lg flex flex-col items-center px-2 font-medium tracking-wide hidden">
|
| 62 |
+
<p class="tracking-normal text-base font-bold">
|
| 63 |
+
Número de Repeticiones:
|
| 64 |
+
</p>
|
| 65 |
{{ form_sesion.numero_repeticiones }}
|
| 66 |
</label>
|
| 67 |
+
{% endif %}
|
| 68 |
</section>
|
| 69 |
<section class="flex justify-center items-center mt-2">
|
| 70 |
<label for="{{form_sesion.instrucciones.id_for_label}}"
|
|
|
|
| 120 |
</label>
|
| 121 |
<div class="flex justify-around max-sm:flex-col gap-8 cts-options-size-scale">
|
| 122 |
<label class="flex flex-col items-center cursor-pointer">
|
| 123 |
+
<input type="radio" name="option_size_scale" value="5"
|
| 124 |
+
class="radio radio-lg checked:bg-pink-500" />
|
| 125 |
<span class="mt-2 text-xl text-gray-700 font-medium">5</span>
|
| 126 |
</label>
|
| 127 |
<label class="flex flex-col items-center cursor-pointer">
|
| 128 |
+
<input type="radio" name="option_size_scale" value="7"
|
| 129 |
+
class="radio radio-lg checked:bg-pink-500" />
|
| 130 |
<span class="mt-2 text-xl text-gray-700 font-medium">7</span>
|
| 131 |
</label>
|
| 132 |
<label class="flex flex-col items-center cursor-pointer">
|
| 133 |
+
<input type="radio" name="option_size_scale" value="9"
|
| 134 |
+
class="radio radio-lg checked:bg-pink-500" />
|
| 135 |
<span class="mt-2 text-xl text-gray-700 font-medium">9</span>
|
| 136 |
</label>
|
| 137 |
</div>
|
tecnicas/templates/tecnicas/create_sesion/configuracion-panel-codes.html
CHANGED
|
@@ -27,12 +27,15 @@
|
|
| 27 |
</label>
|
| 28 |
{% endfor %}
|
| 29 |
</article>
|
|
|
|
| 30 |
<button type="button" class="cts-btn-general cts-btn-secondary btn-push uppercase"
|
| 31 |
onclick="setPermutations()">
|
| 32 |
regenerar ordenes
|
| 33 |
</button>
|
|
|
|
| 34 |
</article>
|
| 35 |
|
|
|
|
| 36 |
<h2 class="text-2xl mb-2 font-bold">Ordenes</h2>
|
| 37 |
<hr>
|
| 38 |
<article class="w-full">
|
|
@@ -42,6 +45,7 @@
|
|
| 42 |
</article>
|
| 43 |
</section>
|
| 44 |
</article>
|
|
|
|
| 45 |
|
| 46 |
<hr>
|
| 47 |
<article class="flex flex-col items-center gap-4">
|
|
@@ -62,11 +66,16 @@
|
|
| 62 |
</a>
|
| 63 |
</article>
|
| 64 |
</form>
|
|
|
|
|
|
|
| 65 |
<input type="number" value="{{ num_tester }}" class="ct-num-cata hidden" disabled>
|
|
|
|
| 66 |
</article>
|
| 67 |
</article>
|
| 68 |
{% endblock %}
|
| 69 |
|
| 70 |
{% block extra_js %}
|
|
|
|
| 71 |
<script src="{% static 'js/panel-codes.js' %}"></script>
|
|
|
|
| 72 |
{% endblock %}
|
|
|
|
| 27 |
</label>
|
| 28 |
{% endfor %}
|
| 29 |
</article>
|
| 30 |
+
{% if use_technique == 'escalas' %}
|
| 31 |
<button type="button" class="cts-btn-general cts-btn-secondary btn-push uppercase"
|
| 32 |
onclick="setPermutations()">
|
| 33 |
regenerar ordenes
|
| 34 |
</button>
|
| 35 |
+
{% endif %}
|
| 36 |
</article>
|
| 37 |
|
| 38 |
+
{% if use_technique == 'escalas' %}
|
| 39 |
<h2 class="text-2xl mb-2 font-bold">Ordenes</h2>
|
| 40 |
<hr>
|
| 41 |
<article class="w-full">
|
|
|
|
| 45 |
</article>
|
| 46 |
</section>
|
| 47 |
</article>
|
| 48 |
+
{% endif %}
|
| 49 |
|
| 50 |
<hr>
|
| 51 |
<article class="flex flex-col items-center gap-4">
|
|
|
|
| 66 |
</a>
|
| 67 |
</article>
|
| 68 |
</form>
|
| 69 |
+
|
| 70 |
+
{% if use_technique == 'escalas' %}
|
| 71 |
<input type="number" value="{{ num_tester }}" class="ct-num-cata hidden" disabled>
|
| 72 |
+
{% endif %}
|
| 73 |
</article>
|
| 74 |
</article>
|
| 75 |
{% endblock %}
|
| 76 |
|
| 77 |
{% block extra_js %}
|
| 78 |
+
{% if use_technique == 'escalas' %}
|
| 79 |
<script src="{% static 'js/panel-codes.js' %}"></script>
|
| 80 |
+
{% endif %}
|
| 81 |
{% endblock %}
|
tecnicas/templates/tecnicas/main-panel.html
CHANGED
|
@@ -33,6 +33,10 @@
|
|
| 33 |
</section>
|
| 34 |
</header>
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
<article class="w-full flex flex-col gap-7 items-center min-sm:mt-7 mt-4 bg-surface-card rounded-lg shadow-lg">
|
| 37 |
<article
|
| 38 |
class="w-5xl max-lg:w-3xl max-md:w-auto p-8 flex flex-col justify-around items-center gap-4 flex-wrap text-3xl max-sm:text-2xl">
|
|
|
|
| 33 |
</section>
|
| 34 |
</header>
|
| 35 |
|
| 36 |
+
{% if error %}
|
| 37 |
+
{% include "./components/error-message.html" with message=error %}
|
| 38 |
+
{% endif %}
|
| 39 |
+
|
| 40 |
<article class="w-full flex flex-col gap-7 items-center min-sm:mt-7 mt-4 bg-surface-card rounded-lg shadow-lg">
|
| 41 |
<article
|
| 42 |
class="w-5xl max-lg:w-3xl max-md:w-auto p-8 flex flex-col justify-around items-center gap-4 flex-wrap text-3xl max-sm:text-2xl">
|
tecnicas/templates/tecnicas/manage_sesions/detalles-sesion.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
|
| 6 |
{% block content %}
|
| 7 |
<article class="cts-container-main">
|
| 8 |
-
<article class="cts-wrap-content relative">
|
| 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
|
|
@@ -17,28 +17,20 @@
|
|
| 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>
|
| 25 |
-
</article>
|
| 26 |
-
{% endif %}
|
| 27 |
-
|
| 28 |
{% if message %}
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
</article>
|
| 34 |
{% endif %}
|
| 35 |
|
| 36 |
<p class="text-black font-bold text-2xl border-b-2">
|
| 37 |
Información general
|
| 38 |
</p>
|
| 39 |
<article
|
| 40 |
-
class="text-black rounded-xl grid grid-cols-2 max-sm:grid-cols-1 gap-3 max-sm:gap-1
|
| 41 |
-
<section
|
|
|
|
| 42 |
<p class="font-bold">
|
| 43 |
Código:
|
| 44 |
</p>
|
|
@@ -47,7 +39,8 @@
|
|
| 47 |
</p>
|
| 48 |
</section>
|
| 49 |
|
| 50 |
-
<section
|
|
|
|
| 51 |
<p class="font-bold">
|
| 52 |
Nombre:
|
| 53 |
</p>
|
|
@@ -60,7 +53,8 @@
|
|
| 60 |
</p>
|
| 61 |
</section>
|
| 62 |
|
| 63 |
-
<section
|
|
|
|
| 64 |
<p class="font-bold">
|
| 65 |
Fecha creación:
|
| 66 |
</p>
|
|
@@ -69,7 +63,8 @@
|
|
| 69 |
</p>
|
| 70 |
</section>
|
| 71 |
|
| 72 |
-
<section
|
|
|
|
| 73 |
<p class="font-bold">
|
| 74 |
Estado:
|
| 75 |
</p>
|
|
@@ -82,7 +77,8 @@
|
|
| 82 |
</p>
|
| 83 |
</section>
|
| 84 |
|
| 85 |
-
<section
|
|
|
|
| 86 |
<p class="font-bold">
|
| 87 |
Estilo palabras:
|
| 88 |
</p>
|
|
@@ -91,7 +87,18 @@
|
|
| 91 |
</p>
|
| 92 |
</section>
|
| 93 |
|
| 94 |
-
<section
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
<p class="font-bold">
|
| 96 |
Técnica:
|
| 97 |
</p>
|
|
@@ -100,7 +107,18 @@
|
|
| 100 |
</p>
|
| 101 |
</section>
|
| 102 |
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
<p class="font-bold">
|
| 105 |
Rep. Hechas:
|
| 106 |
</p>
|
|
@@ -108,8 +126,8 @@
|
|
| 108 |
{{ sesion.tecnica.repeticion }}
|
| 109 |
</p>
|
| 110 |
</section>
|
| 111 |
-
|
| 112 |
-
|
| 113 |
<p class="font-bold">
|
| 114 |
Rep. Max:
|
| 115 |
</p>
|
|
@@ -117,8 +135,23 @@
|
|
| 117 |
{{ sesion.tecnica.repeticiones_max }}
|
| 118 |
</p>
|
| 119 |
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
|
| 121 |
-
<section
|
|
|
|
| 122 |
<p class="font-bold">
|
| 123 |
Instrucciones:
|
| 124 |
</p>
|
|
@@ -192,8 +225,7 @@
|
|
| 192 |
¿Estás seguro de continuar?
|
| 193 |
</p>
|
| 194 |
<div class="flex max-sm:flex-col gap-4 justify-center">
|
| 195 |
-
<button class="cts-btn-general cts-btn-error btn-push"
|
| 196 |
-
onclick="deleteSession()">
|
| 197 |
Estoy seguro
|
| 198 |
</button>
|
| 199 |
<button class="cts-btn-general cts-btn-primary btn-push"
|
|
|
|
| 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
|
|
|
|
| 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>
|
|
|
|
| 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>
|
|
|
|
| 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>
|
|
|
|
| 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>
|
|
|
|
| 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>
|
|
|
|
| 87 |
</p>
|
| 88 |
</section>
|
| 89 |
|
| 90 |
+
<section
|
| 91 |
+
class="bg-surface-card flex flex-wrap items-center justify-center max-sm:justify-normal gap-x-2 p-4 rounded-2xl">
|
| 92 |
+
<p class="font-bold">
|
| 93 |
+
Tipo Escala:
|
| 94 |
+
</p>
|
| 95 |
+
<p class="font-sans text-lg max-sm:text-base font-normal uppercase">
|
| 96 |
+
{{ sesion.tecnica.escala_tecnica }}
|
| 97 |
+
</p>
|
| 98 |
+
</section>
|
| 99 |
+
|
| 100 |
+
<section
|
| 101 |
+
class="bg-surface-ligt flex flex-wrap items-center justify-center max-sm:justify-normal gap-x-2 p-4 rounded-2xl">
|
| 102 |
<p class="font-bold">
|
| 103 |
Técnica:
|
| 104 |
</p>
|
|
|
|
| 107 |
</p>
|
| 108 |
</section>
|
| 109 |
|
| 110 |
+
{% if use_technique == "escalas" %}
|
| 111 |
+
<section
|
| 112 |
+
class="bg-surface-card flex flex-wrap items-center justify-center max-sm:justify-normal gap-x-2 p-4 rounded-2xl">
|
| 113 |
+
<p class="font-bold">
|
| 114 |
+
Catadores Max:
|
| 115 |
+
</p>
|
| 116 |
+
<p class="font-sans text-lg max-sm:text-base font-normal">
|
| 117 |
+
{{ sesion.tecnica.limite_catadores }}
|
| 118 |
+
</p>
|
| 119 |
+
</section>
|
| 120 |
+
<section
|
| 121 |
+
class="bg-surface-card flex flex-wrap items-center justify-center max-sm:justify-normal gap-x-2 p-4 rounded-2xl">
|
| 122 |
<p class="font-bold">
|
| 123 |
Rep. Hechas:
|
| 124 |
</p>
|
|
|
|
| 126 |
{{ sesion.tecnica.repeticion }}
|
| 127 |
</p>
|
| 128 |
</section>
|
| 129 |
+
<section
|
| 130 |
+
class="bg-surface-card flex flex-wrap items-center justify-center max-sm:justify-normal gap-x-2 p-4 rounded-2xl">
|
| 131 |
<p class="font-bold">
|
| 132 |
Rep. Max:
|
| 133 |
</p>
|
|
|
|
| 135 |
{{ sesion.tecnica.repeticiones_max }}
|
| 136 |
</p>
|
| 137 |
</section>
|
| 138 |
+
{% else %}
|
| 139 |
+
<section
|
| 140 |
+
class="bg-surface-card flex flex-wrap items-center justify-center max-sm:justify-normal gap-x-2 p-4 rounded-2xl">
|
| 141 |
+
<p class="font-sans">
|
| 142 |
+
Pueden ingresar tantos catadores como se desee
|
| 143 |
+
</p>
|
| 144 |
+
</section>
|
| 145 |
+
<section
|
| 146 |
+
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">
|
| 147 |
+
<p class="font-sans">
|
| 148 |
+
La técnica usada solo puede realizarse una vez, hay una única repetición
|
| 149 |
+
</p>
|
| 150 |
+
</section>
|
| 151 |
+
{% endif %}
|
| 152 |
|
| 153 |
+
<section
|
| 154 |
+
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">
|
| 155 |
<p class="font-bold">
|
| 156 |
Instrucciones:
|
| 157 |
</p>
|
|
|
|
| 225 |
¿Estás seguro de continuar?
|
| 226 |
</p>
|
| 227 |
<div class="flex max-sm:flex-col gap-4 justify-center">
|
| 228 |
+
<button class="cts-btn-general cts-btn-error btn-push" onclick="deleteSession()">
|
|
|
|
| 229 |
Estoy seguro
|
| 230 |
</button>
|
| 231 |
<button class="cts-btn-general cts-btn-primary btn-push"
|
tecnicas/templates/tecnicas/manage_sesions/monitor-sesion.html
CHANGED
|
@@ -10,14 +10,6 @@
|
|
| 10 |
<h1 class="text-3xl font-bold text-black">Sesión sensorial en curso</h1>
|
| 11 |
</header>
|
| 12 |
|
| 13 |
-
{% if error %}
|
| 14 |
-
<article class="bg-red-600 p-4 text-white rounded-xl ct-notification-error">
|
| 15 |
-
<p class="block font-sans text-white text-xl antialiased font-bold uppercase tracking-wider text-center">
|
| 16 |
-
{{ error }}
|
| 17 |
-
</p>
|
| 18 |
-
</article>
|
| 19 |
-
{% endif %}
|
| 20 |
-
|
| 21 |
<section class="flex flex-col sm:flex-row justify-between items-center gap-10">
|
| 22 |
<p class="text-xl text-center bg-surface-card p-4 text-black rounded-lg shadow-lg">
|
| 23 |
Código de sesión:<br>
|
|
@@ -41,6 +33,10 @@
|
|
| 41 |
{% csrf_token %}
|
| 42 |
</form>
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
{% if message %}
|
| 45 |
{% include "../components/error-message.html" with message=message %}
|
| 46 |
{% endif %}
|
|
@@ -63,12 +59,20 @@
|
|
| 63 |
<h2 class="text-xl font-semibold">Participantes</h2>
|
| 64 |
</div>
|
| 65 |
<section class="flex flex-wrap justify-around items-center">
|
|
|
|
| 66 |
<div class="flex flex-col sm:flex-row sm:items-center sm:gap-2">
|
| 67 |
<span class="font-semibold">Máximo:</span>
|
| 68 |
<span>{{ max_testers }}</span>
|
| 69 |
</div>
|
|
|
|
| 70 |
<div class="flex flex-col sm:flex-row sm:items-center sm:gap-2">
|
| 71 |
-
<span class="font-semibold">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
<span>{{ current_testers }}</span>
|
| 73 |
</div>
|
| 74 |
<div class="flex flex-col sm:flex-row sm:items-center sm:gap-2">
|
|
|
|
| 10 |
<h1 class="text-3xl font-bold text-black">Sesión sensorial en curso</h1>
|
| 11 |
</header>
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
<section class="flex flex-col sm:flex-row justify-between items-center gap-10">
|
| 14 |
<p class="text-xl text-center bg-surface-card p-4 text-black rounded-lg shadow-lg">
|
| 15 |
Código de sesión:<br>
|
|
|
|
| 33 |
{% csrf_token %}
|
| 34 |
</form>
|
| 35 |
|
| 36 |
+
{% if error %}
|
| 37 |
+
{% include "../components/error-message.html" with message=error %}
|
| 38 |
+
{% endif %}
|
| 39 |
+
|
| 40 |
{% if message %}
|
| 41 |
{% include "../components/error-message.html" with message=message %}
|
| 42 |
{% endif %}
|
|
|
|
| 59 |
<h2 class="text-xl font-semibold">Participantes</h2>
|
| 60 |
</div>
|
| 61 |
<section class="flex flex-wrap justify-around items-center">
|
| 62 |
+
{% if use_technique == "escalas" %}
|
| 63 |
<div class="flex flex-col sm:flex-row sm:items-center sm:gap-2">
|
| 64 |
<span class="font-semibold">Máximo:</span>
|
| 65 |
<span>{{ max_testers }}</span>
|
| 66 |
</div>
|
| 67 |
+
{% endif %}
|
| 68 |
<div class="flex flex-col sm:flex-row sm:items-center sm:gap-2">
|
| 69 |
+
<span class="font-semibold">
|
| 70 |
+
{% if use_technique == "escalas" %}
|
| 71 |
+
Actuales:
|
| 72 |
+
{% else %}
|
| 73 |
+
Total:
|
| 74 |
+
{% endif %}
|
| 75 |
+
</span>
|
| 76 |
<span>{{ current_testers }}</span>
|
| 77 |
</div>
|
| 78 |
<div class="flex flex-col sm:flex-row sm:items-center sm:gap-2">
|
tecnicas/templates/tecnicas/manage_sesions/sesiones-panel.html
CHANGED
|
@@ -19,10 +19,14 @@
|
|
| 19 |
</div>
|
| 20 |
</header>
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
{% if error %}
|
| 23 |
{% include "../components/error-message.html" with message=error %}
|
| 24 |
{% else %}
|
| 25 |
-
|
| 26 |
<section class="grid grid-cols-3 max-lg:grid-cols-2 max-sm:grid-cols-1 w-full gap-4 justify-center">
|
| 27 |
{% for sesion in sessions %}
|
| 28 |
{% include "../components/item_session.html" with sesion=sesion %}
|
|
@@ -39,13 +43,13 @@
|
|
| 39 |
</a>
|
| 40 |
{% endif %}
|
| 41 |
<button class="join-item btn bg-btn-secondary">Page {{ num_page }}</button>
|
| 42 |
-
{% if not last_page %}
|
| 43 |
-
<a href="{% url 'cata_system:panel_sesiones' page=num_page|add:1 %}"class="w-fit">
|
| 44 |
<button class="join-item btn bg-btn-secondary py-1">
|
| 45 |
<img class="h-full" src="{% static 'img/greater-than.svg' %}" alt="mayor que">
|
| 46 |
</button>
|
| 47 |
-
|
| 48 |
-
|
| 49 |
</div>
|
| 50 |
</section>
|
| 51 |
{% endif %}
|
|
|
|
| 19 |
</div>
|
| 20 |
</header>
|
| 21 |
|
| 22 |
+
{% if message %}
|
| 23 |
+
{% include "../components/error-message.html" with message=message %}
|
| 24 |
+
{% endif %}
|
| 25 |
+
|
| 26 |
{% if error %}
|
| 27 |
{% include "../components/error-message.html" with message=error %}
|
| 28 |
{% else %}
|
| 29 |
+
|
| 30 |
<section class="grid grid-cols-3 max-lg:grid-cols-2 max-sm:grid-cols-1 w-full gap-4 justify-center">
|
| 31 |
{% for sesion in sessions %}
|
| 32 |
{% include "../components/item_session.html" with sesion=sesion %}
|
|
|
|
| 43 |
</a>
|
| 44 |
{% endif %}
|
| 45 |
<button class="join-item btn bg-btn-secondary">Page {{ num_page }}</button>
|
| 46 |
+
{% if not last_page %}
|
| 47 |
+
<a href="{% url 'cata_system:panel_sesiones' page=num_page|add:1 %}" class="w-fit">
|
| 48 |
<button class="join-item btn bg-btn-secondary py-1">
|
| 49 |
<img class="h-full" src="{% static 'img/greater-than.svg' %}" alt="mayor que">
|
| 50 |
</button>
|
| 51 |
+
</a>
|
| 52 |
+
{% endif %}
|
| 53 |
</div>
|
| 54 |
</section>
|
| 55 |
{% endif %}
|
tecnicas/utils/__init__.py
CHANGED
|
@@ -3,5 +3,6 @@ from .code_generate import generarCodigos
|
|
| 3 |
from .personal_errors import general_error, controller_error
|
| 4 |
from .shuffle_arrays import shuffleArray
|
| 5 |
from .general_controllers import getId
|
|
|
|
| 6 |
from .to_dict import defaultdict_to_dict
|
| 7 |
from .delete_data_session import deleteDataSession
|
|
|
|
| 3 |
from .personal_errors import general_error, controller_error
|
| 4 |
from .shuffle_arrays import shuffleArray
|
| 5 |
from .general_controllers import getId
|
| 6 |
+
from .general_controllers import noValidTechnique
|
| 7 |
from .to_dict import defaultdict_to_dict
|
| 8 |
from .delete_data_session import deleteDataSession
|
tecnicas/utils/general_controllers.py
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
def getId(value: object | int) -> int | None:
|
| 2 |
if isinstance(value, int):
|
| 3 |
return value
|
|
@@ -7,3 +12,12 @@ def getId(value: object | int) -> int | None:
|
|
| 7 |
return value.pk
|
| 8 |
|
| 9 |
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.shortcuts import redirect
|
| 2 |
+
from django.urls import reverse
|
| 3 |
+
from urllib.parse import urlencode
|
| 4 |
+
|
| 5 |
+
|
| 6 |
def getId(value: object | int) -> int | None:
|
| 7 |
if isinstance(value, int):
|
| 8 |
return value
|
|
|
|
| 12 |
return value.pk
|
| 13 |
|
| 14 |
return None
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def noValidTechnique(params: dict, query_params: dict, name_view: str):
|
| 18 |
+
if query_params:
|
| 19 |
+
query_string = urlencode(query_params)
|
| 20 |
+
url_redireccion = f"{reverse({name_view}, kwargs=params)}?{query_string}"
|
| 21 |
+
else:
|
| 22 |
+
url_redireccion = f"{reverse({name_view}, kwargs=params)}"
|
| 23 |
+
return redirect(url_redireccion)
|
tecnicas/views/sessions_config/configuration_panel_basic.py
CHANGED
|
@@ -7,12 +7,14 @@ from tecnicas.utils import deleteDataSession
|
|
| 7 |
|
| 8 |
def configurationPanelBasic(req: HttpRequest):
|
| 9 |
deleteDataSession(req)
|
| 10 |
-
|
| 11 |
if req.method == "GET":
|
| 12 |
name_tecnica = req.GET["name_tecnica"]
|
| 13 |
|
| 14 |
if name_tecnica == "escalas":
|
| 15 |
response = PanelBasicController.controllGetEscalas(request=req)
|
|
|
|
|
|
|
| 16 |
else:
|
| 17 |
response = redirect(
|
| 18 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida o sin implementar")
|
|
@@ -24,6 +26,9 @@ def configurationPanelBasic(req: HttpRequest):
|
|
| 24 |
if name_tecnica == "escalas":
|
| 25 |
response = PanelBasicController.controllPostEscalas(
|
| 26 |
request=req, name_tecnica=name_tecnica)
|
|
|
|
|
|
|
|
|
|
| 27 |
else:
|
| 28 |
response = redirect(
|
| 29 |
reverse("cata_system:seleccion_tecnica") + "?error=¡Oh, vaya! Cambio de técnica repentino, vuelve a elegir otra vez")
|
|
|
|
| 7 |
|
| 8 |
def configurationPanelBasic(req: HttpRequest):
|
| 9 |
deleteDataSession(req)
|
| 10 |
+
|
| 11 |
if req.method == "GET":
|
| 12 |
name_tecnica = req.GET["name_tecnica"]
|
| 13 |
|
| 14 |
if name_tecnica == "escalas":
|
| 15 |
response = PanelBasicController.controllGetEscalas(request=req)
|
| 16 |
+
elif name_tecnica == "rata":
|
| 17 |
+
response = PanelBasicController.controllGetRATA(request=req)
|
| 18 |
else:
|
| 19 |
response = redirect(
|
| 20 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida o sin implementar")
|
|
|
|
| 26 |
if name_tecnica == "escalas":
|
| 27 |
response = PanelBasicController.controllPostEscalas(
|
| 28 |
request=req, name_tecnica=name_tecnica)
|
| 29 |
+
elif name_tecnica == "rata":
|
| 30 |
+
response = PanelBasicController.controllPostRATA(
|
| 31 |
+
request=req, name_tecnica=name_tecnica)
|
| 32 |
else:
|
| 33 |
response = redirect(
|
| 34 |
reverse("cata_system:seleccion_tecnica") + "?error=¡Oh, vaya! Cambio de técnica repentino, vuelve a elegir otra vez")
|
tecnicas/views/sessions_config/configuration_panel_codes.py
CHANGED
|
@@ -10,26 +10,31 @@ def configurationPanelCodes(req: HttpRequest):
|
|
| 10 |
deleteDataSession(req)
|
| 11 |
return redirect(reverse("cata_system:seleccion_tecnica") +
|
| 12 |
"?error=datos del formulario requerido no encontrados")
|
| 13 |
-
|
| 14 |
data_basic = req.session["form_basic"]
|
| 15 |
|
| 16 |
if req.method == "GET":
|
| 17 |
if data_basic["name_tecnica"] == "escalas":
|
| 18 |
response = PanelCodesController.controllGetEscalas(
|
| 19 |
req, data_basic)
|
|
|
|
|
|
|
|
|
|
| 20 |
else:
|
| 21 |
response = redirect(
|
| 22 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
| 23 |
-
|
| 24 |
return response
|
| 25 |
elif req.method == "POST":
|
| 26 |
if data_basic["name_tecnica"] == "escalas":
|
| 27 |
response = PanelCodesController.controllPostEscalas(
|
| 28 |
req, data_basic)
|
|
|
|
|
|
|
| 29 |
else:
|
| 30 |
response = redirect(
|
| 31 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
| 32 |
-
|
| 33 |
return response
|
| 34 |
else:
|
| 35 |
return JsonResponse({"message": "Método no permitido"})
|
|
|
|
| 10 |
deleteDataSession(req)
|
| 11 |
return redirect(reverse("cata_system:seleccion_tecnica") +
|
| 12 |
"?error=datos del formulario requerido no encontrados")
|
| 13 |
+
|
| 14 |
data_basic = req.session["form_basic"]
|
| 15 |
|
| 16 |
if req.method == "GET":
|
| 17 |
if data_basic["name_tecnica"] == "escalas":
|
| 18 |
response = PanelCodesController.controllGetEscalas(
|
| 19 |
req, data_basic)
|
| 20 |
+
elif data_basic["name_tecnica"] == "rata":
|
| 21 |
+
response = PanelCodesController.controllGetRATA(
|
| 22 |
+
req, data_basic)
|
| 23 |
else:
|
| 24 |
response = redirect(
|
| 25 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
| 26 |
+
|
| 27 |
return response
|
| 28 |
elif req.method == "POST":
|
| 29 |
if data_basic["name_tecnica"] == "escalas":
|
| 30 |
response = PanelCodesController.controllPostEscalas(
|
| 31 |
req, data_basic)
|
| 32 |
+
elif data_basic["name_tecnica"] == "rata":
|
| 33 |
+
response = PanelCodesController.controllPostRATA(request=req)
|
| 34 |
else:
|
| 35 |
response = redirect(
|
| 36 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
| 37 |
+
|
| 38 |
return response
|
| 39 |
else:
|
| 40 |
return JsonResponse({"message": "Método no permitido"})
|
tecnicas/views/sessions_config/configuration_panel_tags.py
CHANGED
|
@@ -10,11 +10,11 @@ def configurationPanelTags(req: HttpRequest):
|
|
| 10 |
deleteDataSession(req)
|
| 11 |
return redirect(reverse('cata_system:panel_configuracion_basic') +
|
| 12 |
"?error=datos requeridos no encontrados")
|
| 13 |
-
|
| 14 |
basic_data = req.session.get("form_basic")
|
| 15 |
|
| 16 |
if req.method == "GET":
|
| 17 |
-
if basic_data["name_tecnica"] == "escalas":
|
| 18 |
response = PanelTagsController.controllGetEscalas(
|
| 19 |
request=req, data=basic_data)
|
| 20 |
else:
|
|
@@ -23,7 +23,7 @@ def configurationPanelTags(req: HttpRequest):
|
|
| 23 |
|
| 24 |
return response
|
| 25 |
elif req.method == "POST":
|
| 26 |
-
if basic_data["name_tecnica"] == "escalas":
|
| 27 |
response = PanelTagsController.controllPostEscalas(
|
| 28 |
request=req, data=basic_data)
|
| 29 |
else:
|
|
|
|
| 10 |
deleteDataSession(req)
|
| 11 |
return redirect(reverse('cata_system:panel_configuracion_basic') +
|
| 12 |
"?error=datos requeridos no encontrados")
|
| 13 |
+
|
| 14 |
basic_data = req.session.get("form_basic")
|
| 15 |
|
| 16 |
if req.method == "GET":
|
| 17 |
+
if basic_data["name_tecnica"] == "escalas" or basic_data["name_tecnica"] == "rata":
|
| 18 |
response = PanelTagsController.controllGetEscalas(
|
| 19 |
request=req, data=basic_data)
|
| 20 |
else:
|
|
|
|
| 23 |
|
| 24 |
return response
|
| 25 |
elif req.method == "POST":
|
| 26 |
+
if basic_data["name_tecnica"] == "escalas" or basic_data["name_tecnica"] == "rata":
|
| 27 |
response = PanelTagsController.controllPostEscalas(
|
| 28 |
request=req, data=basic_data)
|
| 29 |
else:
|
tecnicas/views/sessions_config/configuration_panel_words.py
CHANGED
|
@@ -14,7 +14,7 @@ def configurationPanelWords(req: HttpRequest):
|
|
| 14 |
basic_data = req.session["form_basic"]
|
| 15 |
|
| 16 |
if req.method == "GET":
|
| 17 |
-
if basic_data["name_tecnica"] == "escalas":
|
| 18 |
response = PanelWordsController.controllGetEscalas(req)
|
| 19 |
else:
|
| 20 |
response = redirect(
|
|
@@ -22,12 +22,12 @@ def configurationPanelWords(req: HttpRequest):
|
|
| 22 |
|
| 23 |
return response
|
| 24 |
elif req.method == "POST":
|
| 25 |
-
if basic_data["name_tecnica"] == "escalas":
|
| 26 |
response = PanelWordsController.controllPostEscalas(req)
|
| 27 |
else:
|
| 28 |
response = redirect(
|
| 29 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
| 30 |
-
|
| 31 |
return response
|
| 32 |
else:
|
| 33 |
return JsonResponse({"message": "Método no permitido"})
|
|
|
|
| 14 |
basic_data = req.session["form_basic"]
|
| 15 |
|
| 16 |
if req.method == "GET":
|
| 17 |
+
if basic_data["name_tecnica"] == "escalas" or basic_data["name_tecnica"] == "rata":
|
| 18 |
response = PanelWordsController.controllGetEscalas(req)
|
| 19 |
else:
|
| 20 |
response = redirect(
|
|
|
|
| 22 |
|
| 23 |
return response
|
| 24 |
elif req.method == "POST":
|
| 25 |
+
if basic_data["name_tecnica"] == "escalas" or basic_data["name_tecnica"] == "rata":
|
| 26 |
response = PanelWordsController.controllPostEscalas(req)
|
| 27 |
else:
|
| 28 |
response = redirect(
|
| 29 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
| 30 |
+
|
| 31 |
return response
|
| 32 |
else:
|
| 33 |
return JsonResponse({"message": "Método no permitido"})
|
tecnicas/views/sessions_config/create_session.py
CHANGED
|
@@ -14,9 +14,8 @@ def createSession(req: HttpRequest):
|
|
| 14 |
basic_data = req.session["form_basic"]
|
| 15 |
|
| 16 |
if req.method == "GET":
|
| 17 |
-
if basic_data["name_tecnica"] == "escalas":
|
| 18 |
-
response =
|
| 19 |
-
req, 'tecnicas/create_sesion/creando_sesion.html')
|
| 20 |
else:
|
| 21 |
response = redirect(
|
| 22 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
|
@@ -25,6 +24,8 @@ def createSession(req: HttpRequest):
|
|
| 25 |
if req.method == "POST":
|
| 26 |
if basic_data["name_tecnica"] == "escalas":
|
| 27 |
response = PanelCreateController.controllPostEscalas(req)
|
|
|
|
|
|
|
| 28 |
else:
|
| 29 |
response = redirect(
|
| 30 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
|
|
|
| 14 |
basic_data = req.session["form_basic"]
|
| 15 |
|
| 16 |
if req.method == "GET":
|
| 17 |
+
if basic_data["name_tecnica"] == "escalas" or basic_data["name_tecnica"] == "rata":
|
| 18 |
+
response = PanelCreateController.controllGetEscalas(req)
|
|
|
|
| 19 |
else:
|
| 20 |
response = redirect(
|
| 21 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
|
|
|
| 24 |
if req.method == "POST":
|
| 25 |
if basic_data["name_tecnica"] == "escalas":
|
| 26 |
response = PanelCreateController.controllPostEscalas(req)
|
| 27 |
+
elif basic_data["name_tecnica"] == "rata":
|
| 28 |
+
response = PanelCreateController.controllPostRATA(req)
|
| 29 |
else:
|
| 30 |
response = redirect(
|
| 31 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
tecnicas/views/sessions_management/session_details.py
CHANGED
|
@@ -1,33 +1,58 @@
|
|
| 1 |
-
from django.http import HttpRequest
|
| 2 |
-
from django.shortcuts import
|
| 3 |
from django.urls import reverse
|
| 4 |
-
from
|
|
|
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
def sessionDetails(req: HttpRequest, session_code: str):
|
| 8 |
-
controller_view = DetallesSesionController(session_code)
|
| 9 |
-
context = controller_view.getContextForView()
|
| 10 |
-
|
| 11 |
if req.method == "GET":
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
elif req.method == "POST":
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
| 31 |
else:
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.http import HttpRequest, JsonResponse
|
| 2 |
+
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 ...controllers import DetallesEscalasController
|
| 7 |
|
| 8 |
|
| 9 |
def sessionDetails(req: HttpRequest, session_code: str):
|
|
|
|
|
|
|
|
|
|
| 10 |
if req.method == "GET":
|
| 11 |
+
if "message" in req.GET:
|
| 12 |
+
message = req.GET.get("message")
|
| 13 |
+
else:
|
| 14 |
+
message = ""
|
| 15 |
+
|
| 16 |
+
sensorial_session = SesionSensorial.objects.get(
|
| 17 |
+
codigo_sesion=session_code)
|
| 18 |
+
use_techinique = sensorial_session.tecnica.tipo_tecnica.nombre_tecnica
|
| 19 |
+
|
| 20 |
+
if use_techinique == "escalas" or use_techinique == "rata":
|
| 21 |
+
controller_view = DetallesEscalasController(
|
| 22 |
+
session=sensorial_session)
|
| 23 |
+
response = controller_view.getResponse(
|
| 24 |
+
request=req, message=message)
|
| 25 |
+
else:
|
| 26 |
+
response = noValidTechnique(
|
| 27 |
+
params={"page": 1},
|
| 28 |
+
query_params={
|
| 29 |
+
"message": "Al parecer la sesión usa una técnica que aun no se ha implementado para ver detalles"
|
| 30 |
+
},
|
| 31 |
+
name_view="cata_system:panel_sesiones"
|
| 32 |
+
)
|
| 33 |
+
|
| 34 |
+
return response
|
| 35 |
elif req.method == "POST":
|
| 36 |
+
sensorial_session = SesionSensorial.objects.get(
|
| 37 |
+
codigo_sesion=session_code)
|
| 38 |
+
use_techinique = sensorial_session.tecnica.tipo_tecnica.nombre_tecnica
|
| 39 |
+
|
| 40 |
+
if use_techinique == "escalas" or use_techinique == "rata":
|
| 41 |
+
controller_view = DetallesEscalasController(sensorial_session)
|
| 42 |
+
|
| 43 |
+
if req.POST["action"] == "start_session":
|
| 44 |
+
response = controller_view.startRepetition(
|
| 45 |
+
presenter=req.user.user_presentador)
|
| 46 |
+
elif req.POST.get("action") == "delete_session":
|
| 47 |
+
controller_view.deleteSesorialSession()
|
| 48 |
+
response = redirect(
|
| 49 |
+
reverse("cata_system:panel_sesiones", kwargs={"page": 1}))
|
| 50 |
+
else:
|
| 51 |
+
response = controller_view.getResponse(
|
| 52 |
+
error="No se reconoce la acción a realizar")
|
| 53 |
else:
|
| 54 |
+
response = noValidTechnique()
|
| 55 |
+
|
| 56 |
+
return response
|
| 57 |
+
else:
|
| 58 |
+
return JsonResponse({"error": "Método no permitido"})
|
tecnicas/views/sessions_management/session_monitor.py
CHANGED
|
@@ -7,38 +7,57 @@ Para finalizar la sesion se debe realizar lo siguiente
|
|
| 7 |
from django.http import HttpRequest, JsonResponse
|
| 8 |
from django.shortcuts import render, redirect
|
| 9 |
from django.urls import reverse
|
| 10 |
-
from tecnicas.
|
| 11 |
-
from tecnicas.
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
def sessionMonitor(req: HttpRequest, session_code: str):
|
| 15 |
-
controll_view = MonitorSesionController(session_code)
|
| 16 |
-
context = controll_view.monitorView()
|
| 17 |
-
|
| 18 |
if req.method == "GET":
|
| 19 |
-
|
| 20 |
-
|
|
|
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
elif req.method == "POST":
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
else:
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
else:
|
| 31 |
return JsonResponse({"error": "Método no permitido"})
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
def actionFinishSession(context: dict, session_code: str, controll_view: MonitorSesionController, req: HttpRequest):
|
| 35 |
-
context["code_session"] = session_code
|
| 36 |
-
(is_all_end, message) = controll_view.checkAllParticipantsEnded()
|
| 37 |
-
context["message"] = message
|
| 38 |
-
if not is_all_end:
|
| 39 |
-
return render(req, "tecnicas/manage_sesions/monitor-sesion.html", context)
|
| 40 |
-
response = controll_view.finishSession()
|
| 41 |
-
if isinstance(response, dict):
|
| 42 |
-
context["message"] = response["error"]
|
| 43 |
-
return render(req, "tecnicas/manage_sesions/monitor-sesion.html", context)
|
| 44 |
-
return redirect(reverse("cata_system:detalles_sesion", kwargs={"session_code": session_code}))
|
|
|
|
| 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 |
|
| 15 |
def sessionMonitor(req: HttpRequest, session_code: str):
|
|
|
|
|
|
|
|
|
|
| 16 |
if req.method == "GET":
|
| 17 |
+
sensorial_session = SesionSensorial.objects.get(
|
| 18 |
+
codigo_sesion=session_code)
|
| 19 |
+
use_techinique = sensorial_session.tecnica.tipo_tecnica.nombre_tecnica
|
| 20 |
|
| 21 |
+
if use_techinique == "escalas" or use_techinique == "rata":
|
| 22 |
+
controll_view = MonitorEscalasController(sensorial_session)
|
| 23 |
+
response = controll_view.controlGetResponse(request=req)
|
| 24 |
+
else:
|
| 25 |
+
response = noValidTechnique(
|
| 26 |
+
params={
|
| 27 |
+
"session_code": session_code,
|
| 28 |
+
},
|
| 29 |
+
query_params={
|
| 30 |
+
"message": "Aun no se puede monitorear sesiones con esta técnica"
|
| 31 |
+
},
|
| 32 |
+
name_view="cata_system:detalles_sesion"
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
return response
|
| 36 |
elif req.method == "POST":
|
| 37 |
+
sensorial_session = SesionSensorial.objects.get(
|
| 38 |
+
codigo_sesion=session_code)
|
| 39 |
+
use_techinique = sensorial_session.tecnica.tipo_tecnica.nombre_tecnica
|
| 40 |
+
|
| 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.controlPostResponseFinishSession(
|
| 46 |
+
request=req)
|
| 47 |
+
else:
|
| 48 |
+
response = controll_view.controlGetResponse(
|
| 49 |
+
request=req, error="No se ha definido la acción a realizar")
|
| 50 |
else:
|
| 51 |
+
response = noValidTechnique(
|
| 52 |
+
params={
|
| 53 |
+
"session_code": session_code,
|
| 54 |
+
},
|
| 55 |
+
query_params={
|
| 56 |
+
"message": "La técnica usada en la sesión aun no se implementa para esta función"
|
| 57 |
+
},
|
| 58 |
+
name_view="cata_system:detalles_sesion"
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
return response
|
| 62 |
else:
|
| 63 |
return JsonResponse({"error": "Método no permitido"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tecnicas/views/sessions_management/sessions_panel.py
CHANGED
|
@@ -1,22 +1,27 @@
|
|
| 1 |
-
from django.http import HttpRequest
|
| 2 |
from django.shortcuts import render
|
| 3 |
-
from
|
| 4 |
|
| 5 |
|
| 6 |
def sesionsPanel(req: HttpRequest, page: int):
|
| 7 |
context = {"num_page": page}
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.http import HttpRequest, JsonResponse
|
| 2 |
from django.shortcuts import render
|
| 3 |
+
from tecnicas.controllers import SesionController
|
| 4 |
|
| 5 |
|
| 6 |
def sesionsPanel(req: HttpRequest, page: int):
|
| 7 |
context = {"num_page": page}
|
| 8 |
|
| 9 |
+
if req.method == "GET":
|
| 10 |
+
response = SesionController.getSessionsSavesByCretor(
|
| 11 |
+
user_name=req.user.username, page=page)
|
| 12 |
|
| 13 |
+
if isinstance(response, dict):
|
| 14 |
+
context["error"] = response["error"]
|
| 15 |
+
return render(req, "tecnicas/manage_sesions/sesiones-panel.html", context=context)
|
| 16 |
+
|
| 17 |
+
(sessions_in_page, is_last_page, current_page) = response
|
| 18 |
|
| 19 |
+
context["sessions"] = sessions_in_page
|
| 20 |
+
context["last_page"] = is_last_page
|
| 21 |
+
context["num_paginas"] = current_page
|
| 22 |
+
if "message" in req.GET:
|
| 23 |
+
context["message"] = req.GET.get("message")
|
| 24 |
|
| 25 |
+
return render(req, "tecnicas/manage_sesions/sesiones-panel.html", context=context)
|
| 26 |
+
else:
|
| 27 |
+
return JsonResponse({"message": "Método no permitido"})
|
tecnicas/views/tester_forms/init_tester_form.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
| 1 |
from django.http import HttpRequest, JsonResponse
|
| 2 |
from django.shortcuts import render, redirect
|
| 3 |
from django.urls import reverse
|
| 4 |
-
from tecnicas.controllers import
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
def initTesterForm(req: HttpRequest, code_sesion: str):
|
| 8 |
-
session =
|
| 9 |
|
| 10 |
context = {
|
| 11 |
"session": session
|
|
@@ -17,16 +18,20 @@ def initTesterForm(req: HttpRequest, code_sesion: str):
|
|
| 17 |
template_url = "tecnicas/forms_tester/init_session.html"
|
| 18 |
|
| 19 |
if req.method == "GET":
|
| 20 |
-
order = view_controller.
|
| 21 |
|
| 22 |
-
if
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
context["has_ended"] = True
|
| 30 |
|
| 31 |
return render(req, template_url, context)
|
| 32 |
elif req.method == "POST":
|
|
@@ -35,26 +40,13 @@ def initTesterForm(req: HttpRequest, code_sesion: str):
|
|
| 35 |
"code_sesion": code_sesion
|
| 36 |
}
|
| 37 |
|
| 38 |
-
if "id_order" in req.session:
|
| 39 |
-
update_participation = ParticipacionController.enterSession(
|
| 40 |
-
tester=req.user.user_catador, session=session)
|
| 41 |
-
if isinstance(update_participation, dict):
|
| 42 |
-
context["error"] = update_participation["error"]
|
| 43 |
-
return render(req, template_url, context)
|
| 44 |
-
|
| 45 |
-
return redirect(reverse("cata_system:session_convencional", kwargs=parameters))
|
| 46 |
-
|
| 47 |
-
order = view_controller.assignOrder()
|
| 48 |
-
if isinstance(order, dict):
|
| 49 |
-
context["error"] = order["error"]
|
| 50 |
-
return render(req, template_url, context)
|
| 51 |
-
|
| 52 |
update_participation = ParticipacionController.enterSession(
|
| 53 |
tester=req.user.user_catador, session=session)
|
| 54 |
if isinstance(update_participation, dict):
|
| 55 |
context["error"] = update_participation["error"]
|
| 56 |
return render(req, template_url, context)
|
| 57 |
|
|
|
|
| 58 |
return redirect(reverse("cata_system:session_convencional", kwargs=parameters))
|
| 59 |
elif req.POST["action"] == "exit_session":
|
| 60 |
response = ParticipacionController.outSession(
|
|
@@ -67,11 +59,3 @@ def initTesterForm(req: HttpRequest, code_sesion: str):
|
|
| 67 |
return render(req, template_url, context)
|
| 68 |
else:
|
| 69 |
return JsonResponse({"error": "metodo no permitido"})
|
| 70 |
-
|
| 71 |
-
# req.session["cata_username"] = tester_user
|
| 72 |
-
# req.session["id_cata"] = tester.id
|
| 73 |
-
# req.session["code_session"] = session_code
|
| 74 |
-
# req.session["id_techniqe"] = session.tecnica.id
|
| 75 |
-
# req.session["id_participation"] = taster_participation.id
|
| 76 |
-
|
| 77 |
-
# response.set_cookie('id_participacion', taster_participation.id, max_age=60*60*24)
|
|
|
|
| 1 |
from django.http import HttpRequest, JsonResponse
|
| 2 |
from django.shortcuts import render, redirect
|
| 3 |
from django.urls import reverse
|
| 4 |
+
from tecnicas.controllers import MainTesterFormController, ParticipacionController
|
| 5 |
+
from tecnicas.models import SesionSensorial
|
| 6 |
|
| 7 |
|
| 8 |
def initTesterForm(req: HttpRequest, code_sesion: str):
|
| 9 |
+
session = SesionSensorial.objects.get(codigo_sesion=code_sesion)
|
| 10 |
|
| 11 |
context = {
|
| 12 |
"session": session
|
|
|
|
| 18 |
template_url = "tecnicas/forms_tester/init_session.html"
|
| 19 |
|
| 20 |
if req.method == "GET":
|
| 21 |
+
order = view_controller.checkAndAssignOrder()
|
| 22 |
|
| 23 |
+
if isinstance(order, dict):
|
| 24 |
+
context["error"] = order["error"]
|
| 25 |
+
return render(req, template_url, context)
|
| 26 |
+
|
| 27 |
+
is_end = view_controller.isEndedSession(
|
| 28 |
+
repetition=session.tecnica.repeticion)
|
| 29 |
+
|
| 30 |
+
req.session["id_order"] = order.id
|
| 31 |
+
context["has_ended"] = is_end
|
| 32 |
|
| 33 |
+
if is_end:
|
| 34 |
+
context["message"] = "El catador ha terminado de realizar su evaluación, espere instrucciones del presentador"
|
|
|
|
| 35 |
|
| 36 |
return render(req, template_url, context)
|
| 37 |
elif req.method == "POST":
|
|
|
|
| 40 |
"code_sesion": code_sesion
|
| 41 |
}
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
update_participation = ParticipacionController.enterSession(
|
| 44 |
tester=req.user.user_catador, session=session)
|
| 45 |
if isinstance(update_participation, dict):
|
| 46 |
context["error"] = update_participation["error"]
|
| 47 |
return render(req, template_url, context)
|
| 48 |
|
| 49 |
+
req.session["id_participation"] = update_participation.id
|
| 50 |
return redirect(reverse("cata_system:session_convencional", kwargs=parameters))
|
| 51 |
elif req.POST["action"] == "exit_session":
|
| 52 |
response = ParticipacionController.outSession(
|
|
|
|
| 59 |
return render(req, template_url, context)
|
| 60 |
else:
|
| 61 |
return JsonResponse({"error": "metodo no permitido"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|