Spaces:
Sleeping
Sleeping
Ingreso a sesion con cata
Browse files- tecnicas/controllers/__init__.py +3 -1
- tecnicas/controllers/views_controller/sessions_tester/general_test_controller.py +14 -0
- tecnicas/controllers/views_controller/sessions_tester/test_cata_controller.py +55 -0
- tecnicas/controllers/views_controller/sessions_tester/test_rata_controller.py +81 -0
- tecnicas/controllers/views_controller/sessions_tester/{convencional_scales_controller.py → test_scales_controller.py} +8 -84
- tecnicas/templates/tecnicas/forms_tester/cata.html +121 -0
- tecnicas/urls.py +4 -0
- tecnicas/views/__init__.py +3 -1
- tecnicas/views/sessions_management/session_details.py +2 -2
- tecnicas/views/sessions_management/session_monitor.py +1 -1
- tecnicas/views/tester_forms/cata_test.py +12 -0
- tecnicas/views/tester_forms/convencional_scales.py +11 -6
tecnicas/controllers/__init__.py
CHANGED
|
@@ -28,8 +28,10 @@ from .views_controller.session_management.monitor_rata_controller import Monitor
|
|
| 28 |
|
| 29 |
from .views_controller.sessions_tester.login_session_tester_controller import LoginSessionTesterController
|
| 30 |
from .views_controller.sessions_tester.init_session_tester_controller import InitSessionTesterController
|
| 31 |
-
from .views_controller.sessions_tester.convencional_scales_controller import ConvencionalScalesController
|
| 32 |
from .views_controller.sessions_tester.list_sessions_tester_controller import ListSessionsTesterController
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
from .views_controller.vocabulary_manage.create_vocabulary_controller import CreateVocabularyController
|
| 35 |
from .views_controller.vocabulary_manage.list_vocabulary_controller import ListVocabularyController
|
|
|
|
| 28 |
|
| 29 |
from .views_controller.sessions_tester.login_session_tester_controller import LoginSessionTesterController
|
| 30 |
from .views_controller.sessions_tester.init_session_tester_controller import InitSessionTesterController
|
|
|
|
| 31 |
from .views_controller.sessions_tester.list_sessions_tester_controller import ListSessionsTesterController
|
| 32 |
+
from .views_controller.sessions_tester.test_scales_controller import TestScalesController
|
| 33 |
+
from .views_controller.sessions_tester.test_rata_controller import TestRataController
|
| 34 |
+
from .views_controller.sessions_tester.test_cata_controller import TestCataController
|
| 35 |
|
| 36 |
from .views_controller.vocabulary_manage.create_vocabulary_controller import CreateVocabularyController
|
| 37 |
from .views_controller.vocabulary_manage.list_vocabulary_controller import ListVocabularyController
|
tecnicas/controllers/views_controller/sessions_tester/general_test_controller.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.http import HttpRequest
|
| 2 |
+
from django.shortcuts import redirect, render
|
| 3 |
+
from django.urls import reverse
|
| 4 |
+
from tecnicas.models import SesionSensorial, Catador
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
class GenetalTestController():
|
| 8 |
+
previus_directory = "cata_system:catador_init_session"
|
| 9 |
+
context = {}
|
| 10 |
+
current_directory: str
|
| 11 |
+
|
| 12 |
+
def __init__(self, sensorial_session: SesionSensorial, user_tester: Catador):
|
| 13 |
+
self.tester = user_tester
|
| 14 |
+
self.session = sensorial_session
|
tecnicas/controllers/views_controller/sessions_tester/test_cata_controller.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.http import HttpRequest
|
| 2 |
+
from django.shortcuts import redirect, render
|
| 3 |
+
from django.urls import reverse
|
| 4 |
+
from tecnicas.models import Producto, Participacion, Palabra, Calificacion
|
| 5 |
+
from tecnicas.controllers import PalabrasController
|
| 6 |
+
from .general_test_controller import GenetalTestController
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class TestCataController(GenetalTestController):
|
| 10 |
+
def __init__(self, sensorial_session, user_tester):
|
| 11 |
+
super().__init__(sensorial_session, user_tester)
|
| 12 |
+
self.current_directory = "tecnicas/forms_tester/cata.html"
|
| 13 |
+
|
| 14 |
+
def controllGet(self, request: HttpRequest):
|
| 15 |
+
technique = self.session.tecnica
|
| 16 |
+
self.participation = Participacion.objects.get(
|
| 17 |
+
tecnica=technique, catador=request.user.user_catador)
|
| 18 |
+
|
| 19 |
+
self.context["session"] = self.session
|
| 20 |
+
|
| 21 |
+
products_in_technique = Producto.objects.filter(id_tecnica=technique)
|
| 22 |
+
|
| 23 |
+
words = PalabrasController.getWordsInTechnique(technique=technique)
|
| 24 |
+
|
| 25 |
+
use_product: Producto = None
|
| 26 |
+
use_words: list[Palabra] = None
|
| 27 |
+
|
| 28 |
+
# Revisamos el producto que le falten calificaciones
|
| 29 |
+
for current_product in products_in_technique:
|
| 30 |
+
try:
|
| 31 |
+
rating = Calificacion.objects.get(
|
| 32 |
+
num_repeticion=technique.repeticion,
|
| 33 |
+
id_producto=current_product,
|
| 34 |
+
id_tecnica=technique,
|
| 35 |
+
id_catador=self.tester
|
| 36 |
+
)
|
| 37 |
+
except Calificacion.DoesNotExist:
|
| 38 |
+
# Si no hay calificacion mandamos el producto actual y todas la palabras
|
| 39 |
+
use_product = current_product
|
| 40 |
+
use_words = words
|
| 41 |
+
break
|
| 42 |
+
|
| 43 |
+
# Si no hay producto que falta por calificar finalizar sesion para el Catador
|
| 44 |
+
if not use_product:
|
| 45 |
+
updated_participation = ParticipacionController.finishSession(
|
| 46 |
+
self.participation)
|
| 47 |
+
params = {
|
| 48 |
+
"code_sesion": self.session.codigo_sesion
|
| 49 |
+
}
|
| 50 |
+
return redirect(reverse(self.previus_directory, kwargs=params))
|
| 51 |
+
|
| 52 |
+
self.context["product"] = use_product
|
| 53 |
+
self.context["words"] = use_words
|
| 54 |
+
|
| 55 |
+
return render(request, self.current_directory, self.context)
|
tecnicas/controllers/views_controller/sessions_tester/test_rata_controller.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.http import HttpRequest
|
| 2 |
+
from django.shortcuts import redirect, render
|
| 3 |
+
from django.urls import reverse
|
| 4 |
+
from tecnicas.models import Participacion, Producto, Calificacion, Palabra
|
| 5 |
+
from tecnicas.controllers import ParticipacionController, PalabrasController, EscalaController
|
| 6 |
+
from .general_test_controller import GenetalTestController
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class TestRataController(GenetalTestController):
|
| 10 |
+
def __init__(self, sensorial_session, user_tester):
|
| 11 |
+
super().__init__(sensorial_session, user_tester)
|
| 12 |
+
self.current_directory = "tecnicas/forms_tester/convencional.html"
|
| 13 |
+
|
| 14 |
+
def controllGet(self, request: HttpRequest):
|
| 15 |
+
technique = self.session.tecnica
|
| 16 |
+
self.participation = Participacion.objects.get(
|
| 17 |
+
tecnica=technique, catador=request.user.user_catador)
|
| 18 |
+
|
| 19 |
+
self.context["session"] = self.session
|
| 20 |
+
|
| 21 |
+
products_in_technique = Producto.objects.filter(id_tecnica=technique)
|
| 22 |
+
|
| 23 |
+
words = PalabrasController.getWordsInTechnique(technique=technique)
|
| 24 |
+
|
| 25 |
+
use_product: Producto = None
|
| 26 |
+
use_words: list[Palabra] = None
|
| 27 |
+
|
| 28 |
+
# Revisamos el producto que le falten calificaciones
|
| 29 |
+
for current_product in products_in_technique:
|
| 30 |
+
try:
|
| 31 |
+
rating = Calificacion.objects.get(
|
| 32 |
+
num_repeticion=technique.repeticion,
|
| 33 |
+
id_producto=current_product,
|
| 34 |
+
id_tecnica=technique,
|
| 35 |
+
id_catador=self.tester
|
| 36 |
+
)
|
| 37 |
+
except Calificacion.DoesNotExist:
|
| 38 |
+
# Si no hay calificacion mandamos el producto actual y todas la palabras
|
| 39 |
+
use_product = current_product
|
| 40 |
+
use_words = words
|
| 41 |
+
break
|
| 42 |
+
|
| 43 |
+
# Obtener los datos asociados para la calificacion para ver que palabras quedan por calificar
|
| 44 |
+
recoreded_data = rating.dato_calificacion.all()
|
| 45 |
+
|
| 46 |
+
if not recoreded_data:
|
| 47 |
+
# Si no hay datos entonces devolver el producto con todas las palabras
|
| 48 |
+
use_product = current_product
|
| 49 |
+
use_words = words
|
| 50 |
+
break
|
| 51 |
+
else:
|
| 52 |
+
words_to_use = PalabrasController.getWordsWithoutData(
|
| 53 |
+
recoreded_data=recoreded_data, words=words)
|
| 54 |
+
|
| 55 |
+
# Si quedan palabras por calificar mandar las palabras con el producto
|
| 56 |
+
if not isinstance(words_to_use, dict) and words_to_use:
|
| 57 |
+
use_product = current_product
|
| 58 |
+
use_words = words_to_use
|
| 59 |
+
break
|
| 60 |
+
|
| 61 |
+
# Si no hay producto que falta por calificar finalizar sesion para el Catador
|
| 62 |
+
if not use_product:
|
| 63 |
+
updated_participation = ParticipacionController.finishSession(
|
| 64 |
+
self.participation)
|
| 65 |
+
params = {
|
| 66 |
+
"code_sesion": self.session.codigo_sesion
|
| 67 |
+
}
|
| 68 |
+
return redirect(reverse(self.previus_directory, kwargs=params))
|
| 69 |
+
|
| 70 |
+
self.context["product"] = use_product
|
| 71 |
+
self.context["words"] = use_words
|
| 72 |
+
|
| 73 |
+
# Agregar informacion de la escala
|
| 74 |
+
scale = EscalaController.getScaleByTechnique(technique=technique)
|
| 75 |
+
self.context["scale"] = scale
|
| 76 |
+
self.context["type_scale"] = scale.id_tipo_escala.nombre_escala
|
| 77 |
+
|
| 78 |
+
use_tags = EscalaController.getRelatedTagsInScale(scale=scale)
|
| 79 |
+
self.context["tags"] = use_tags
|
| 80 |
+
|
| 81 |
+
return render(request, self.current_directory, self.context)
|
tecnicas/controllers/views_controller/sessions_tester/{convencional_scales_controller.py → test_scales_controller.py}
RENAMED
|
@@ -2,19 +2,16 @@ from django.http import HttpRequest
|
|
| 2 |
from django.shortcuts import redirect, render
|
| 3 |
from django.urls import reverse
|
| 4 |
from tecnicas.models import SesionSensorial, Catador, Participacion, Producto, Calificacion, Palabra
|
| 5 |
-
from tecnicas.controllers import PosicionController, CalificacionController, ParticipacionController, PalabrasController, EscalaController
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
-
class
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
|
| 13 |
-
def
|
| 14 |
-
self.tester = user_tester
|
| 15 |
-
self.session = sensorial_session
|
| 16 |
-
|
| 17 |
-
def controllGetEscalas(self, request: HttpRequest):
|
| 18 |
technique = self.session.tecnica
|
| 19 |
self.participation = Participacion.objects.get(
|
| 20 |
tecnica=technique, catador=request.user.user_catador)
|
|
@@ -82,77 +79,4 @@ class ConvencionalScalesController:
|
|
| 82 |
ctx["type_scale"] = scale.id_tipo_escala.nombre_escala
|
| 83 |
ctx["tags"] = EscalaController.getRelatedTagsInScale(scale=scale)
|
| 84 |
|
| 85 |
-
return render(request, self.current_directory, ctx)
|
| 86 |
-
|
| 87 |
-
def controllGetRATA(self, request: HttpRequest):
|
| 88 |
-
technique = self.session.tecnica
|
| 89 |
-
self.participation = Participacion.objects.get(
|
| 90 |
-
tecnica=technique, catador=request.user.user_catador)
|
| 91 |
-
|
| 92 |
-
self.context["session"] = self.session
|
| 93 |
-
|
| 94 |
-
products_in_technique = Producto.objects.filter(id_tecnica=technique)
|
| 95 |
-
|
| 96 |
-
words = PalabrasController.getWordsInTechnique(technique=technique)
|
| 97 |
-
|
| 98 |
-
use_product: Producto = None
|
| 99 |
-
use_words: list[Palabra] = None
|
| 100 |
-
|
| 101 |
-
# Revisamos el producto que le falten calificaciones
|
| 102 |
-
for current_product in products_in_technique:
|
| 103 |
-
try:
|
| 104 |
-
rating = Calificacion.objects.get(
|
| 105 |
-
num_repeticion=technique.repeticion,
|
| 106 |
-
id_producto=current_product,
|
| 107 |
-
id_tecnica=technique,
|
| 108 |
-
id_catador=self.tester
|
| 109 |
-
)
|
| 110 |
-
there_rating = True
|
| 111 |
-
except Calificacion.DoesNotExist:
|
| 112 |
-
there_rating = False
|
| 113 |
-
|
| 114 |
-
# Si no hay calificacion mandamos el producto actual y todas la palabras
|
| 115 |
-
if not there_rating:
|
| 116 |
-
use_product = current_product
|
| 117 |
-
use_words = words
|
| 118 |
-
break
|
| 119 |
-
|
| 120 |
-
# Obtener los datos asociados para la calificacion para ver que palabras quedan por calificar
|
| 121 |
-
recoreded_data = rating.dato_calificacion.all()
|
| 122 |
-
|
| 123 |
-
if not recoreded_data:
|
| 124 |
-
# Si no hay datos entonces devolver el producto con todas las palabras
|
| 125 |
-
use_product = current_product
|
| 126 |
-
use_words = words
|
| 127 |
-
break
|
| 128 |
-
else:
|
| 129 |
-
words_to_use = PalabrasController.getWordsWithoutData(
|
| 130 |
-
recoreded_data=recoreded_data, words=words)
|
| 131 |
-
|
| 132 |
-
# Si quedan palabras por calificar mandar las palabras con el producto
|
| 133 |
-
if not isinstance(words_to_use, dict) and words_to_use:
|
| 134 |
-
use_product = current_product
|
| 135 |
-
use_words = words_to_use
|
| 136 |
-
break
|
| 137 |
-
|
| 138 |
-
# Si no hay producto que falta por calificar finalizar sesion para el Catador
|
| 139 |
-
if not use_product:
|
| 140 |
-
updated_participation = ParticipacionController.finishSession(
|
| 141 |
-
self.participation)
|
| 142 |
-
params = {
|
| 143 |
-
"code_sesion": self.session.codigo_sesion
|
| 144 |
-
}
|
| 145 |
-
return redirect(reverse(self.previus_directory, kwargs=params))
|
| 146 |
-
|
| 147 |
-
self.context["product"] = use_product
|
| 148 |
-
self.context["words"] = use_words
|
| 149 |
-
|
| 150 |
-
# Agregar informacion de la escala
|
| 151 |
-
scale = EscalaController.getScaleByTechnique(technique=technique)
|
| 152 |
-
self.context["scale"] = scale
|
| 153 |
-
self.context["type_scale"] = scale.id_tipo_escala.nombre_escala
|
| 154 |
-
|
| 155 |
-
use_tags = EscalaController.getRelatedTagsInScale(scale=scale)
|
| 156 |
-
self.context["tags"] = use_tags
|
| 157 |
-
|
| 158 |
-
return render(request, self.current_directory, self.context)
|
|
|
|
| 2 |
from django.shortcuts import redirect, render
|
| 3 |
from django.urls import reverse
|
| 4 |
from tecnicas.models import SesionSensorial, Catador, Participacion, Producto, Calificacion, Palabra
|
| 5 |
+
from tecnicas.controllers import PosicionController, CalificacionController, ParticipacionController, PalabrasController, EscalaController
|
| 6 |
+
from .general_test_controller import GenetalTestController
|
| 7 |
|
| 8 |
|
| 9 |
+
class TestScalesController(GenetalTestController):
|
| 10 |
+
def __init__(self, sensorial_session, user_tester):
|
| 11 |
+
super().__init__(sensorial_session, user_tester)
|
| 12 |
+
self.current_directory = "tecnicas/forms_tester/convencional.html"
|
| 13 |
|
| 14 |
+
def controllGet(self, request: HttpRequest):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
technique = self.session.tecnica
|
| 16 |
self.participation = Participacion.objects.get(
|
| 17 |
tecnica=technique, catador=request.user.user_catador)
|
|
|
|
| 79 |
ctx["type_scale"] = scale.id_tipo_escala.nombre_escala
|
| 80 |
ctx["tags"] = EscalaController.getRelatedTagsInScale(scale=scale)
|
| 81 |
|
| 82 |
+
return render(request, self.current_directory, ctx)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tecnicas/templates/tecnicas/forms_tester/cata.html
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'tecnicas/layouts/base.html' %}
|
| 2 |
+
|
| 3 |
+
{% load static %}
|
| 4 |
+
|
| 5 |
+
{% block title %}Convencional{% endblock %}
|
| 6 |
+
|
| 7 |
+
{% block content %}
|
| 8 |
+
<article class="cts-container-main">
|
| 9 |
+
<article class="cts-wrap-content text-black">
|
| 10 |
+
<header class="text-center flex-row w-full items-stretch flex justify-around flex-wrap gap-2">
|
| 11 |
+
<h1 class="rounded font-bold text-2xl bg-surface-ligt p-4 flex-1">
|
| 12 |
+
Sesión usando <br>técnica
|
| 13 |
+
<span class="uppercase">{{ session.tecnica.tipo_tecnica }}</span>
|
| 14 |
+
</h1>
|
| 15 |
+
<button class="cts-btn-general cts-btn-error btn-push" onclick="exit_sesion('form-actions')">
|
| 16 |
+
Salir de la sesión
|
| 17 |
+
</button>
|
| 18 |
+
</header>
|
| 19 |
+
|
| 20 |
+
<article class="hidden">
|
| 21 |
+
<form action="{% url 'cata_system:catador_init_session' code_sesion=session.codigo_sesion %}" method="post"
|
| 22 |
+
class="form-actions">
|
| 23 |
+
{% csrf_token %}
|
| 24 |
+
<input type="hidden" name="action" class="action-input">
|
| 25 |
+
</form>
|
| 26 |
+
</article>
|
| 27 |
+
|
| 28 |
+
<section class="hidden">
|
| 29 |
+
<input type="hidden" value="{{ session.tecnica.id }}" name="id-tecnica" class="ct-input-id-tech">
|
| 30 |
+
</section>
|
| 31 |
+
|
| 32 |
+
{% if error %}
|
| 33 |
+
{% include "../components/error-message.html" with message=error %}
|
| 34 |
+
{% endif %}
|
| 35 |
+
{% if message %}
|
| 36 |
+
{% include "../components/error-message.html" with message=message %}
|
| 37 |
+
{% endif %}
|
| 38 |
+
|
| 39 |
+
<article class="rounded flex flex-col gap-4">
|
| 40 |
+
<section class="flex items-center justify-center bg-surface-ligt p-2 rounded-lg">
|
| 41 |
+
<p class="text-lg font-medium text-center">
|
| 42 |
+
{{ session.tecnica.instrucciones }}
|
| 43 |
+
</p>
|
| 44 |
+
</section>
|
| 45 |
+
<section class="flex items-center justify-center flex-wrap gap-4">
|
| 46 |
+
<div class="bg-surface-ligt p-2 rounded-lg flex-1">
|
| 47 |
+
<p class="text-lg font-bold text-center">
|
| 48 |
+
Producto:
|
| 49 |
+
</p>
|
| 50 |
+
<p class="text-2xl font-bold text-center ct-product-rating">
|
| 51 |
+
<span class="code-product">{{ product }}</span>
|
| 52 |
+
<span class="hidden id-product">{{ product.id }}</span>
|
| 53 |
+
</p>
|
| 54 |
+
</div>
|
| 55 |
+
<div class="bg-surface-ligt p-2 rounded-lg flex-1">
|
| 56 |
+
<p class="text-lg font-bold text-center">
|
| 57 |
+
Repetición:
|
| 58 |
+
</p>
|
| 59 |
+
<p class="text-2xl font-bold text-center">
|
| 60 |
+
{{ session.tecnica.repeticion }}
|
| 61 |
+
</p>
|
| 62 |
+
</div>
|
| 63 |
+
</section>
|
| 64 |
+
<section class="flex flex-col bg-red-200 py-2 px-4 rounded-lg min-sm:hidden">
|
| 65 |
+
<p>
|
| 66 |
+
El largo de estas escalas puede afectar la vista en dispositivos móviles. Para ver el resto de la
|
| 67 |
+
escala puede deslizar con el dedo a la derecha o la izquierda sin tocar la escala.
|
| 68 |
+
</p>
|
| 69 |
+
</section>
|
| 70 |
+
</article>
|
| 71 |
+
|
| 72 |
+
<article class="words-check-container w-full max-w-3xl mx-auto p-6 bg-base-200 rounded-xl shadow-lg">
|
| 73 |
+
<form id="wordsForm" method="POST" class="flex flex-col gap-4">
|
| 74 |
+
{% csrf_token %}
|
| 75 |
+
{% for word in words %}
|
| 76 |
+
<label
|
| 77 |
+
class="flex items-center justify-between bg-base-100 p-4 rounded-lg shadow-sm hover:shadow-md transition-all">
|
| 78 |
+
<span class="text-lg font-medium">{{ word }}</span>
|
| 79 |
+
<input type="checkbox" name="word_{{ word.id }}" class="checkbox checkbox-primary"
|
| 80 |
+
data-word-id="{{ word.id }}" />
|
| 81 |
+
</label>
|
| 82 |
+
{% empty %}
|
| 83 |
+
<p class="text-center text-gray-500">No hay palabras disponibles.</p>
|
| 84 |
+
{% endfor %}
|
| 85 |
+
|
| 86 |
+
<button type="submit" class="btn btn-primary mt-6">
|
| 87 |
+
Enviar calificaciones
|
| 88 |
+
</button>
|
| 89 |
+
</form>
|
| 90 |
+
</article>
|
| 91 |
+
</article>
|
| 92 |
+
</article>
|
| 93 |
+
|
| 94 |
+
<script>
|
| 95 |
+
document.addEventListener("DOMContentLoaded", () => {
|
| 96 |
+
const form = document.getElementById("wordsForm")
|
| 97 |
+
|
| 98 |
+
form.addEventListener("submit", (e) => {
|
| 99 |
+
e.preventDefault() // prevenimos envío por defecto
|
| 100 |
+
const checkboxes = form.querySelectorAll('input[type="checkbox"]')
|
| 101 |
+
const unchecked = Array.from(checkboxes).filter(cb => !cb.checked)
|
| 102 |
+
|
| 103 |
+
if (unchecked.length > 0) {
|
| 104 |
+
const confirmLeaveBlank = confirm(
|
| 105 |
+
"Algunas palabras no han sido marcadas. ¿Deseas continuar dejando esas casillas en blanco?"
|
| 106 |
+
)
|
| 107 |
+
|
| 108 |
+
if (!confirmLeaveBlank) {
|
| 109 |
+
return
|
| 110 |
+
}
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
form.submit()
|
| 114 |
+
})
|
| 115 |
+
});
|
| 116 |
+
</script>
|
| 117 |
+
{% endblock %}
|
| 118 |
+
|
| 119 |
+
{% block extra_js %}
|
| 120 |
+
<script src="{% static 'js/actions-form.js' %}"></script>
|
| 121 |
+
{% endblock %}
|
tecnicas/urls.py
CHANGED
|
@@ -110,6 +110,10 @@ urlpatterns = [
|
|
| 110 |
views.convencionalScales,
|
| 111 |
name="session_convencional"),
|
| 112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
# APIs
|
| 115 |
path("presenter/api/nueva-etiqueta",
|
|
|
|
| 110 |
views.convencionalScales,
|
| 111 |
name="session_convencional"),
|
| 112 |
|
| 113 |
+
path("testers/init-session/<str:code_sesion>/cata",
|
| 114 |
+
views.cataTest,
|
| 115 |
+
name="session_cata"),
|
| 116 |
+
|
| 117 |
|
| 118 |
# APIs
|
| 119 |
path("presenter/api/nueva-etiqueta",
|
tecnicas/views/__init__.py
CHANGED
|
@@ -28,7 +28,9 @@ from .apis.api_words import wordsVocabulary
|
|
| 28 |
from .apis.rating_word import reatingWord
|
| 29 |
|
| 30 |
from .tester_forms.init_tester_form import initTesterForm
|
| 31 |
-
from .tester_forms.convencional_scales import convencionalScales
|
| 32 |
from .tester_forms.panel_main_tester import mainPanelTester
|
| 33 |
from .tester_forms.login_session import loginSessionTester
|
| 34 |
from .tester_forms.sessions_list_tester import sessionsListTester
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
from .apis.rating_word import reatingWord
|
| 29 |
|
| 30 |
from .tester_forms.init_tester_form import initTesterForm
|
|
|
|
| 31 |
from .tester_forms.panel_main_tester import mainPanelTester
|
| 32 |
from .tester_forms.login_session import loginSessionTester
|
| 33 |
from .tester_forms.sessions_list_tester import sessionsListTester
|
| 34 |
+
from .tester_forms.convencional_scales import convencionalScales
|
| 35 |
+
from .tester_forms.cata_test import cataTest
|
| 36 |
+
|
tecnicas/views/sessions_management/session_details.py
CHANGED
|
@@ -35,14 +35,14 @@ def sessionDetails(req: HttpRequest, session_code: str):
|
|
| 35 |
},
|
| 36 |
name_view="cata_system:panel_sesiones"
|
| 37 |
)
|
| 38 |
-
|
| 39 |
return response
|
|
|
|
| 40 |
elif req.method == "POST":
|
| 41 |
sensorial_session = SesionSensorial.objects.get(
|
| 42 |
codigo_sesion=session_code)
|
| 43 |
use_techinique = sensorial_session.tecnica.tipo_tecnica.nombre_tecnica
|
| 44 |
|
| 45 |
-
if use_techinique == "escalas" or use_techinique == "rata":
|
| 46 |
controller_view = DetallesEscalasController(sensorial_session)
|
| 47 |
|
| 48 |
if req.POST["action"] == "start_session":
|
|
|
|
| 35 |
},
|
| 36 |
name_view="cata_system:panel_sesiones"
|
| 37 |
)
|
|
|
|
| 38 |
return response
|
| 39 |
+
|
| 40 |
elif req.method == "POST":
|
| 41 |
sensorial_session = SesionSensorial.objects.get(
|
| 42 |
codigo_sesion=session_code)
|
| 43 |
use_techinique = sensorial_session.tecnica.tipo_tecnica.nombre_tecnica
|
| 44 |
|
| 45 |
+
if use_techinique == "escalas" or use_techinique == "rata" or use_techinique == "cata":
|
| 46 |
controller_view = DetallesEscalasController(sensorial_session)
|
| 47 |
|
| 48 |
if req.POST["action"] == "start_session":
|
tecnicas/views/sessions_management/session_monitor.py
CHANGED
|
@@ -18,7 +18,7 @@ def sessionMonitor(req: HttpRequest, session_code: str):
|
|
| 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:
|
|
|
|
| 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" or use_techinique == "cata":
|
| 22 |
controll_view = MonitorEscalasController(sensorial_session)
|
| 23 |
response = controll_view.controlGetResponse(request=req)
|
| 24 |
else:
|
tecnicas/views/tester_forms/cata_test.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.http import HttpRequest
|
| 2 |
+
from tecnicas.models import SesionSensorial
|
| 3 |
+
from tecnicas.controllers import TestCataController
|
| 4 |
+
from tecnicas.utils import noValidTechnique
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def cataTest(req: HttpRequest, code_sesion: str):
|
| 8 |
+
if req.method == "GET":
|
| 9 |
+
session = SesionSensorial.objects.get(codigo_sesion=code_sesion)
|
| 10 |
+
controll_view = TestCataController(
|
| 11 |
+
sensorial_session=session, user_tester=req.user.user_catador)
|
| 12 |
+
return controll_view.controllGet(request=req)
|
tecnicas/views/tester_forms/convencional_scales.py
CHANGED
|
@@ -55,21 +55,26 @@
|
|
| 55 |
- Cata segmento en el que se divide debe tener la etiqueda correspondiente por debajo
|
| 56 |
'''
|
| 57 |
from django.http import HttpRequest
|
| 58 |
-
from tecnicas.
|
|
|
|
| 59 |
from tecnicas.utils import noValidTechnique
|
| 60 |
|
| 61 |
|
| 62 |
def convencionalScales(req: HttpRequest, code_sesion: str):
|
| 63 |
-
session =
|
| 64 |
type_technique = session.tecnica.tipo_tecnica.nombre_tecnica
|
| 65 |
|
| 66 |
if req.method == "GET":
|
| 67 |
-
view_controller = ConvencionalScalesController(
|
| 68 |
-
sensorial_session=session, user_tester=req.user.user_catador)
|
| 69 |
if type_technique == "escalas":
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
| 71 |
elif type_technique == "rata":
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
| 73 |
else:
|
| 74 |
respose = noValidTechnique(
|
| 75 |
name_view='cata_system:catador_init_session',
|
|
|
|
| 55 |
- Cata segmento en el que se divide debe tener la etiqueda correspondiente por debajo
|
| 56 |
'''
|
| 57 |
from django.http import HttpRequest
|
| 58 |
+
from tecnicas.models import SesionSensorial
|
| 59 |
+
from tecnicas.controllers import TestRataController, TestScalesController
|
| 60 |
from tecnicas.utils import noValidTechnique
|
| 61 |
|
| 62 |
|
| 63 |
def convencionalScales(req: HttpRequest, code_sesion: str):
|
| 64 |
+
session = SesionSensorial.objects.get(codigo_sesion=code_sesion)
|
| 65 |
type_technique = session.tecnica.tipo_tecnica.nombre_tecnica
|
| 66 |
|
| 67 |
if req.method == "GET":
|
|
|
|
|
|
|
| 68 |
if type_technique == "escalas":
|
| 69 |
+
view_controller = TestScalesController(
|
| 70 |
+
sensorial_session=session, user_tester=req.user.user_catador)
|
| 71 |
+
respose = view_controller.controllGet(request=req)
|
| 72 |
+
|
| 73 |
elif type_technique == "rata":
|
| 74 |
+
view_controller = TestRataController(
|
| 75 |
+
sensorial_session=session, user_tester=req.user.user_catador)
|
| 76 |
+
respose = view_controller.controllGet(request=req)
|
| 77 |
+
|
| 78 |
else:
|
| 79 |
respose = noValidTechnique(
|
| 80 |
name_view='cata_system:catador_init_session',
|