Spaces:
Sleeping
Sleeping
Correcion al finalizar session, los estatus de finalizado persisten
Browse files- tecnicas/controllers/models_controller/particiapacion_controller.py +6 -9
- tecnicas/controllers/models_controller/sesion_controller.py +0 -8
- tecnicas/controllers/views_controller/session_management/details_escala_controller.py +15 -3
- tecnicas/controllers/views_controller/session_management/monitor_controller.py +0 -4
- tecnicas/controllers/views_controller/session_management/monitor_escalas_controller.py +1 -1
- tecnicas/controllers/views_controller/sessions_tester/init_session_tester_controller.py +3 -3
- tecnicas/controllers/views_controller/sessions_tester/login_session_tester_controller.py +23 -23
- tecnicas/templates/tecnicas/components/form-scale-continue.html +62 -0
- tecnicas/templates/tecnicas/components/form-scale-structure.html +52 -0
- tecnicas/templates/tecnicas/forms_tester/convencional.html +10 -125
- tecnicas/templates/tecnicas/forms_tester/init_session.html +1 -1
- tecnicas/templates/tecnicas/manage_sesions/detalles-sesion.html +12 -1
- tecnicas/views/tester_forms/convencional_scales.py +10 -3
- tecnicas/views/tester_forms/init_tester_form.py +2 -5
tecnicas/controllers/models_controller/particiapacion_controller.py
CHANGED
|
@@ -16,15 +16,12 @@ class ParticipacionController():
|
|
| 16 |
return controller_error("No se ha encontrado la participación")
|
| 17 |
|
| 18 |
@staticmethod
|
| 19 |
-
def finishSession(
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
return participation
|
| 26 |
-
except Participacion.DoesNotExist:
|
| 27 |
-
return controller_error("No se ha encontrado la participación")
|
| 28 |
|
| 29 |
@staticmethod
|
| 30 |
def outSession(tester: Catador, session: SesionSensorial):
|
|
|
|
| 16 |
return controller_error("No se ha encontrado la participación")
|
| 17 |
|
| 18 |
@staticmethod
|
| 19 |
+
def finishSession(participation: Participacion):
|
| 20 |
+
participation.refresh_from_db()
|
| 21 |
+
participation.finalizado = True
|
| 22 |
+
participation.activo = False
|
| 23 |
+
participation.save()
|
| 24 |
+
return participation
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
@staticmethod
|
| 27 |
def outSession(tester: Catador, session: SesionSensorial):
|
tecnicas/controllers/models_controller/sesion_controller.py
CHANGED
|
@@ -131,14 +131,6 @@ class SesionController():
|
|
| 131 |
else:
|
| 132 |
use_session = session
|
| 133 |
|
| 134 |
-
(is_update_participations,
|
| 135 |
-
message) = ParticipacionController.outAllInSession(use_session)
|
| 136 |
-
|
| 137 |
-
if not is_update_participations:
|
| 138 |
-
return controller_error(message)
|
| 139 |
-
|
| 140 |
use_session.activo = False
|
| 141 |
-
|
| 142 |
use_session.save()
|
| 143 |
-
|
| 144 |
return session
|
|
|
|
| 131 |
else:
|
| 132 |
use_session = session
|
| 133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
use_session.activo = False
|
|
|
|
| 135 |
use_session.save()
|
|
|
|
| 136 |
return session
|
tecnicas/controllers/views_controller/session_management/details_escala_controller.py
CHANGED
|
@@ -15,7 +15,7 @@ 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
|
|
@@ -34,7 +34,7 @@ class DetallesEscalasController(DetallesController):
|
|
| 34 |
context["error"] = error
|
| 35 |
if message != "" or message:
|
| 36 |
context["message"] = message
|
| 37 |
-
|
| 38 |
return render(
|
| 39 |
request, self.url_template, context)
|
| 40 |
|
|
@@ -43,10 +43,13 @@ class DetallesEscalasController(DetallesController):
|
|
| 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(
|
|
@@ -77,6 +80,9 @@ class DetallesEscalasController(DetallesController):
|
|
| 77 |
ratings_for_repetition)
|
| 78 |
self.context["existen_calificaciones"] = True
|
| 79 |
|
|
|
|
|
|
|
|
|
|
| 80 |
return self.context
|
| 81 |
|
| 82 |
def startRepetition(self, presenter: Presentador):
|
|
@@ -87,9 +93,15 @@ class DetallesEscalasController(DetallesController):
|
|
| 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
|
| 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 |
|
|
|
|
| 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, ParticipacionController
|
| 19 |
from .details_controller import DetallesController
|
| 20 |
from tecnicas.utils import defaultdict_to_dict, controller_error
|
| 21 |
from collections import defaultdict
|
|
|
|
| 34 |
context["error"] = error
|
| 35 |
if message != "" or message:
|
| 36 |
context["message"] = message
|
| 37 |
+
|
| 38 |
return render(
|
| 39 |
request, self.url_template, context)
|
| 40 |
|
|
|
|
| 43 |
"use_technique": self.session.tecnica.tipo_tecnica.nombre_tecnica
|
| 44 |
}
|
| 45 |
self.context["sesion"] = self.session
|
| 46 |
+
|
| 47 |
+
# Recuperar la palabras de la tecnica
|
| 48 |
self.words = PalabrasController.getWordsInTechnique(
|
| 49 |
self.session.tecnica)
|
| 50 |
self.context["palabras"] = [word.nombre_palabra for word in self.words]
|
| 51 |
|
| 52 |
+
# Se recuperan las calificaciones
|
| 53 |
ratings_for_repetition = []
|
| 54 |
|
| 55 |
ratings = CalificacionController.getRatingsByTechnique(
|
|
|
|
| 80 |
ratings_for_repetition)
|
| 81 |
self.context["existen_calificaciones"] = True
|
| 82 |
|
| 83 |
+
# Se comprueba que ya no se pueda iniciar la repeticion
|
| 84 |
+
self.context["fin_repeticiones"] = self.session.tecnica.repeticion >= self.session.tecnica.repeticiones_max
|
| 85 |
+
|
| 86 |
return self.context
|
| 87 |
|
| 88 |
def startRepetition(self, presenter: Presentador):
|
|
|
|
| 93 |
return self.getResponse(error="Solo el presentador que crea la sesión puede iniciar la repetición")
|
| 94 |
elif self.session.activo:
|
| 95 |
return self.getResponse(error="La sesión ya está activada")
|
| 96 |
+
elif technique.repeticion >= technique.repeticiones_max:
|
| 97 |
return self.getResponse(error="Se ha alcanzado el número de repeticiones máxima")
|
| 98 |
|
| 99 |
+
(is_update_participations,
|
| 100 |
+
message) = ParticipacionController.outAllInSession(self.session)
|
| 101 |
+
|
| 102 |
+
if not is_update_participations:
|
| 103 |
+
return self.getResponse(error=message)
|
| 104 |
+
|
| 105 |
self.session.activo = True
|
| 106 |
technique.repeticion = technique.repeticion + 1
|
| 107 |
|
tecnicas/controllers/views_controller/session_management/monitor_controller.py
CHANGED
|
@@ -4,7 +4,3 @@ from tecnicas.models import SesionSensorial
|
|
| 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)
|
|
|
|
| 4 |
class MonitorController():
|
| 5 |
def __init__(self, session: SesionSensorial):
|
| 6 |
self.sensorial_session = session
|
|
|
|
|
|
|
|
|
|
|
|
tecnicas/controllers/views_controller/session_management/monitor_escalas_controller.py
CHANGED
|
@@ -89,5 +89,5 @@ class MonitorEscalasController(MonitorController):
|
|
| 89 |
response = SesionController.finishRepetion(self.sensorial_session)
|
| 90 |
if isinstance(response, dict):
|
| 91 |
return controller_error(response["error"])
|
| 92 |
-
self.
|
| 93 |
return self.sensorial_session
|
|
|
|
| 89 |
response = SesionController.finishRepetion(self.sensorial_session)
|
| 90 |
if isinstance(response, dict):
|
| 91 |
return controller_error(response["error"])
|
| 92 |
+
self.sensorial_session.refresh_from_db()
|
| 93 |
return self.sensorial_session
|
tecnicas/controllers/views_controller/sessions_tester/init_session_tester_controller.py
CHANGED
|
@@ -54,7 +54,7 @@ class InitSessionTesterController():
|
|
| 54 |
if is_end:
|
| 55 |
context["message"] = "El catador ha terminado de realizar su evaluación, espere instrucciones del presentador"
|
| 56 |
return render(request, self.current_direction, context)
|
| 57 |
-
|
| 58 |
update_participation = ParticipacionController.enterSession(
|
| 59 |
tester=request.user.user_catador, session=self.session)
|
| 60 |
if isinstance(update_participation, dict):
|
|
@@ -137,10 +137,10 @@ class InitSessionTesterController():
|
|
| 137 |
|
| 138 |
num_words: int
|
| 139 |
|
| 140 |
-
if style_words
|
| 141 |
num_words = EsAtributo.objects.get(
|
| 142 |
id_tecnica=self.session.tecnica).palabras.count()
|
| 143 |
-
elif style_words
|
| 144 |
num_words = EsVocabulario.objects.get(
|
| 145 |
id_tecnica=self.session.tecnica).id_vocabulario.palabras.count()
|
| 146 |
|
|
|
|
| 54 |
if is_end:
|
| 55 |
context["message"] = "El catador ha terminado de realizar su evaluación, espere instrucciones del presentador"
|
| 56 |
return render(request, self.current_direction, context)
|
| 57 |
+
|
| 58 |
update_participation = ParticipacionController.enterSession(
|
| 59 |
tester=request.user.user_catador, session=self.session)
|
| 60 |
if isinstance(update_participation, dict):
|
|
|
|
| 137 |
|
| 138 |
num_words: int
|
| 139 |
|
| 140 |
+
if style_words == "atributos":
|
| 141 |
num_words = EsAtributo.objects.get(
|
| 142 |
id_tecnica=self.session.tecnica).palabras.count()
|
| 143 |
+
elif style_words == "vocabulario":
|
| 144 |
num_words = EsVocabulario.objects.get(
|
| 145 |
id_tecnica=self.session.tecnica).id_vocabulario.palabras.count()
|
| 146 |
|
tecnicas/controllers/views_controller/sessions_tester/login_session_tester_controller.py
CHANGED
|
@@ -33,38 +33,38 @@ class LoginSessionTesterController():
|
|
| 33 |
context["error"] = "La sesión no está activa actualmente"
|
| 34 |
return render(request, self.current_direcction, context)
|
| 35 |
|
| 36 |
-
if self.session.tecnica.repeticion
|
| 37 |
try:
|
| 38 |
self.taster_participation = Participacion.objects.get(
|
| 39 |
tecnica=self.session.tecnica, catador=self.tester)
|
| 40 |
context["error"] = "Usted ya esta dentro de la sesión"
|
| 41 |
return render(request, self.current_direcction, context)
|
| 42 |
except Participacion.DoesNotExist:
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
code_session = self.session.codigo_sesion
|
| 48 |
-
self.session = SesionSensorial.objects.select_for_update().get(
|
| 49 |
-
codigo_sesion=code_session)
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
def validateEntryRATA(self, request: HttpRequest):
|
| 70 |
context = {}
|
|
|
|
| 33 |
context["error"] = "La sesión no está activa actualmente"
|
| 34 |
return render(request, self.current_direcction, context)
|
| 35 |
|
| 36 |
+
if self.session.tecnica.repeticion == 1:
|
| 37 |
try:
|
| 38 |
self.taster_participation = Participacion.objects.get(
|
| 39 |
tecnica=self.session.tecnica, catador=self.tester)
|
| 40 |
context["error"] = "Usted ya esta dentro de la sesión"
|
| 41 |
return render(request, self.current_direcction, context)
|
| 42 |
except Participacion.DoesNotExist:
|
| 43 |
+
with transaction.atomic():
|
| 44 |
+
code_session = self.session.codigo_sesion
|
| 45 |
+
self.session = SesionSensorial.objects.select_for_update().get(
|
| 46 |
+
codigo_sesion=code_session)
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
+
max_testers = self.session.tecnica.limite_catadores
|
| 49 |
+
current_num_testers = Participacion.objects.filter(
|
| 50 |
+
tecnica=self.session.tecnica).count()
|
| 51 |
|
| 52 |
+
if current_num_testers >= max_testers:
|
| 53 |
+
context["error"] = "La sesión ha alcanzado el número máximo de catadores"
|
| 54 |
+
return render(request, self.current_direcction, context)
|
| 55 |
|
| 56 |
+
self.taster_participation = Participacion.objects.create(
|
| 57 |
+
tecnica=self.session.tecnica,
|
| 58 |
+
catador=self.tester,
|
| 59 |
+
finalizado=False
|
| 60 |
+
)
|
| 61 |
+
params = {
|
| 62 |
+
"code_sesion": self.session.codigo_sesion
|
| 63 |
+
}
|
| 64 |
+
return redirect(reverse(self.destinity_direcction, kwargs=params))
|
| 65 |
+
else:
|
| 66 |
+
context["error"] = "Ya no es posible ingresar a la sesión"
|
| 67 |
+
return render(request, self.current_direcction, context)
|
| 68 |
|
| 69 |
def validateEntryRATA(self, request: HttpRequest):
|
| 70 |
context = {}
|
tecnicas/templates/tecnicas/components/form-scale-continue.html
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<form action="" method="post" class="form-rating-{{word}} w-full">
|
| 2 |
+
{% csrf_token %}
|
| 3 |
+
<article class="overflow-x-scroll w-full">
|
| 4 |
+
<article class="bg-surface-card p-6 rounded-lg mb-3 w-fit">
|
| 5 |
+
<label for="id-range-word-{{word}}"
|
| 6 |
+
class="text-xl font-bold tracking-wide block mb-6 first-letter:uppercase">{{ word }}</label>
|
| 7 |
+
|
| 8 |
+
<span class="hidden id-word">{{ word.id }}</span>
|
| 9 |
+
|
| 10 |
+
<section class="block">
|
| 11 |
+
<div class="relative mx-6">
|
| 12 |
+
<input type="range" type="range" min="0" max="1000" value="500" name="rating-word"
|
| 13 |
+
class="range range-md text-blue-400 [--range-bg:orange] [--range-thumb:blue] [--range-fill:0]"
|
| 14 |
+
style="width: {{scale.longitud}}cm;">
|
| 15 |
+
|
| 16 |
+
<div class="absolute top-0 left-0 w-0.5 transform -translate-x-1/2 h-full bg-red-500 z-10">
|
| 17 |
+
</div>
|
| 18 |
+
|
| 19 |
+
<div class="absolute top-1/5 left-1/2 w-0.5 transform -translate-x-1/2 h-4/5 bg-red-500 z-10">
|
| 20 |
+
</div>
|
| 21 |
+
|
| 22 |
+
<div class="absolute top-0 right-0 w-0.5 transform -translate-x-1/2 h-full bg-red-500 z-10">
|
| 23 |
+
</div>
|
| 24 |
+
</div>
|
| 25 |
+
|
| 26 |
+
<div class="flex justify-between mt-4">
|
| 27 |
+
<div class="flex flex-col items-start text-left w-[100px]">
|
| 28 |
+
<span class="text-xs font-medium text-gray-700 break-words first-letter:capitalize">
|
| 29 |
+
{{ tags.0.id_etiqueta }}
|
| 30 |
+
</span>
|
| 31 |
+
</div>
|
| 32 |
+
<div class="flex flex-col items-start text-center w-[100px]">
|
| 33 |
+
<span class="text-xs font-medium text-gray-700 break-words first-letter:capitalize">
|
| 34 |
+
{{ tags.1.id_etiqueta }}
|
| 35 |
+
</span>
|
| 36 |
+
</div>
|
| 37 |
+
<div class="flex flex-col items-start text-right w-[100px]">
|
| 38 |
+
<span class="text-xs font-medium text-gray-700 break-words first-letter:capitalize">
|
| 39 |
+
{{ tags.2.id_etiqueta }}
|
| 40 |
+
</span>
|
| 41 |
+
</div>
|
| 42 |
+
</div>
|
| 43 |
+
</section>
|
| 44 |
+
</article>
|
| 45 |
+
</article>
|
| 46 |
+
<article class="flex flex-col justify-center gap-2 items-end actions-{{word}}">
|
| 47 |
+
<section class="flex justify-end items-center gap-2 btns-container">
|
| 48 |
+
<button type="button" onclick="checkSendRating('{{word}}')"
|
| 49 |
+
class="ct-btn-check-{{word}} cts-btn-general-compress py-2 px-4 cts-btn-secondary btn-push">
|
| 50 |
+
¿Guardar calificación?
|
| 51 |
+
</button>
|
| 52 |
+
<button type="button" onclick="sendRating('{{word}}')"
|
| 53 |
+
class="ct-btn-submit-{{word}} cts-btn-general-compress py-2 px-4 cts-btn-primary btn-push hidden">
|
| 54 |
+
Estoy seguro
|
| 55 |
+
</button>
|
| 56 |
+
<button type="button" onclick="cancelSendRating('{{word}}')"
|
| 57 |
+
class="ct-btn-cancel-{{word}} cts-btn-general-compress py-2 px-4 cts-btn-error btn-push hidden">
|
| 58 |
+
Cancelar
|
| 59 |
+
</button>
|
| 60 |
+
</section>
|
| 61 |
+
</article>
|
| 62 |
+
</form>
|
tecnicas/templates/tecnicas/components/form-scale-structure.html
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<form action="" method="post" class="form-rating-{{ word }} w-full">
|
| 2 |
+
{% csrf_token %}
|
| 3 |
+
<article class="overflow-x-scroll w-full">
|
| 4 |
+
<article class="bg-surface-card p-6 rounded-lg mb-3 w-fit">
|
| 5 |
+
<label for="id-scale-word-{{ word }}"
|
| 6 |
+
class="text-xl font-bold tracking-wide block mb-6 first-letter:uppercase">{{ word }}</label>
|
| 7 |
+
<span class="hidden id-word">{{ word.id }}</span>
|
| 8 |
+
|
| 9 |
+
<section>
|
| 10 |
+
<div class="w-full min-w-xs">
|
| 11 |
+
<div class="relative mx-6">
|
| 12 |
+
<input type="range" min="1" max="{{ scale.longitud }}" step="1" name="rating-word"
|
| 13 |
+
class="w-full range range-md text-blue-400 [--range-bg:orange] [--range-thumb:blue] [--range-fill:0] z-5">
|
| 14 |
+
<div class="absolute top-0 left-0 w-full h-full z-10 flex justify-between pointer-events-none">
|
| 15 |
+
{% for tag in tags %}
|
| 16 |
+
<div class="w-0.5 transform -translate-x-1/2 h-full bg-red-500">
|
| 17 |
+
</div>
|
| 18 |
+
{% endfor %}
|
| 19 |
+
</div>
|
| 20 |
+
</div>
|
| 21 |
+
|
| 22 |
+
<div class="flex justify-between mt-4 text-xs gap-1">
|
| 23 |
+
{% for tag in tags %}
|
| 24 |
+
<div class="flex items-center justify-center text-center w-[70px]">
|
| 25 |
+
<span class="text-xs font-medium text-gray-700 break-words first-letter:capitalize">
|
| 26 |
+
{{ tag.id_etiqueta }}
|
| 27 |
+
</span>
|
| 28 |
+
</div>
|
| 29 |
+
{% endfor %}
|
| 30 |
+
</div>
|
| 31 |
+
</div>
|
| 32 |
+
</section>
|
| 33 |
+
</article>
|
| 34 |
+
</article>
|
| 35 |
+
|
| 36 |
+
<article class="flex flex-col justify-center gap-2 items-end actions-{{ word }}">
|
| 37 |
+
<section class="flex justify-end items-center gap-2 btns-container">
|
| 38 |
+
<button type="button" onclick="checkSendRating('{{ word }}')"
|
| 39 |
+
class="ct-btn-check-{{ word }} cts-btn-general-compress py-2 px-4 cts-btn-secondary btn-push">
|
| 40 |
+
¿Guardar calificación?
|
| 41 |
+
</button>
|
| 42 |
+
<button type="button" onclick="sendRating('{{ word }}')"
|
| 43 |
+
class="ct-btn-submit-{{ word }} cts-btn-general-compress py-2 px-4 cts-btn-primary btn-push hidden">
|
| 44 |
+
Estoy seguro
|
| 45 |
+
</button>
|
| 46 |
+
<button type="button" onclick="cancelSendRating('{{ word }}')"
|
| 47 |
+
class="ct-btn-cancel-{{ word }} cts-btn-general-compress py-2 px-4 cts-btn-error btn-push hidden">
|
| 48 |
+
Cancelar
|
| 49 |
+
</button>
|
| 50 |
+
</section>
|
| 51 |
+
</article>
|
| 52 |
+
</form>
|
tecnicas/templates/tecnicas/forms_tester/convencional.html
CHANGED
|
@@ -37,7 +37,8 @@
|
|
| 37 |
<article class="cts-wrap-content text-black">
|
| 38 |
<header class="text-center flex-row w-full items-stretch flex justify-around flex-wrap gap-2">
|
| 39 |
<h1 class="rounded font-bold text-2xl bg-surface-ligt p-4 flex-1">
|
| 40 |
-
Sesión usando <br>técnica
|
|
|
|
| 41 |
</h1>
|
| 42 |
<button class="cts-btn-general cts-btn-error btn-push" onclick="exit_sesion('form-actions')">
|
| 43 |
Salir de la sesión
|
|
@@ -45,7 +46,8 @@
|
|
| 45 |
</header>
|
| 46 |
|
| 47 |
<article class="hidden">
|
| 48 |
-
<form action="{% url 'cata_system:catador_init_session' code_sesion=session.codigo_sesion %}" method="post"
|
|
|
|
| 49 |
{% csrf_token %}
|
| 50 |
<input type="hidden" name="action" class="action-input">
|
| 51 |
</form>
|
|
@@ -96,130 +98,13 @@
|
|
| 96 |
<article
|
| 97 |
class="scales-container [&>*:not(:last-child)]:mb-5 min-lg:grid min-lg:items-start grid-cols-2 gap-3 justify-center items-center">
|
| 98 |
{% if type_scale == "continua" %}
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
{%
|
| 102 |
-
<article class="overflow-x-scroll w-full">
|
| 103 |
-
<article class="bg-surface-card p-6 rounded-lg mb-3 w-fit">
|
| 104 |
-
<label for="id-range-word-{{word}}"
|
| 105 |
-
class="text-xl font-bold tracking-wide block mb-6 first-letter:uppercase">{{ word }}</label>
|
| 106 |
-
|
| 107 |
-
<span class="hidden id-word">{{ word.id }}</span>
|
| 108 |
-
|
| 109 |
-
<section class="block">
|
| 110 |
-
<div class="relative mx-6">
|
| 111 |
-
<input type="range" type="range" min="0" max="1000" value="500" name="rating-word"
|
| 112 |
-
class="range range-md text-blue-400 [--range-bg:orange] [--range-thumb:blue] [--range-fill:0]"
|
| 113 |
-
style="width: {{scale.longitud}}cm;">
|
| 114 |
-
|
| 115 |
-
<div
|
| 116 |
-
class="absolute top-0 left-0 w-0.5 transform -translate-x-1/2 h-full bg-red-500 z-10">
|
| 117 |
-
</div>
|
| 118 |
-
|
| 119 |
-
<div
|
| 120 |
-
class="absolute top-1/5 left-1/2 w-0.5 transform -translate-x-1/2 h-4/5 bg-red-500 z-10">
|
| 121 |
-
</div>
|
| 122 |
-
|
| 123 |
-
<div
|
| 124 |
-
class="absolute top-0 right-0 w-0.5 transform -translate-x-1/2 h-full bg-red-500 z-10">
|
| 125 |
-
</div>
|
| 126 |
-
</div>
|
| 127 |
-
|
| 128 |
-
<div class="flex justify-between mt-4">
|
| 129 |
-
<div class="flex flex-col items-start text-left w-[100px]">
|
| 130 |
-
<span class="text-xs font-medium text-gray-700 break-words first-letter:capitalize">
|
| 131 |
-
{{ tags.0.id_etiqueta }}
|
| 132 |
-
</span>
|
| 133 |
-
</div>
|
| 134 |
-
<div class="flex flex-col items-start text-center w-[100px]">
|
| 135 |
-
<span class="text-xs font-medium text-gray-700 break-words first-letter:capitalize">
|
| 136 |
-
{{ tags.1.id_etiqueta }}
|
| 137 |
-
</span>
|
| 138 |
-
</div>
|
| 139 |
-
<div class="flex flex-col items-start text-right w-[100px]">
|
| 140 |
-
<span class="text-xs font-medium text-gray-700 break-words first-letter:capitalize">
|
| 141 |
-
{{ tags.2.id_etiqueta }}
|
| 142 |
-
</span>
|
| 143 |
-
</div>
|
| 144 |
-
</div>
|
| 145 |
-
</section>
|
| 146 |
-
</article>
|
| 147 |
-
</article>
|
| 148 |
-
<article class="flex flex-col justify-center gap-2 items-end actions-{{word}}">
|
| 149 |
-
<section class="flex justify-end items-center gap-2 btns-container">
|
| 150 |
-
<button type="button" onclick="checkSendRating('{{word}}')"
|
| 151 |
-
class="ct-btn-check-{{word}} cts-btn-general-compress py-2 px-4 cts-btn-secondary btn-push">
|
| 152 |
-
¿Guardar calificación?
|
| 153 |
-
</button>
|
| 154 |
-
<button type="button" onclick="sendRating('{{word}}')"
|
| 155 |
-
class="ct-btn-submit-{{word}} cts-btn-general-compress py-2 px-4 cts-btn-primary btn-push hidden">
|
| 156 |
-
Estoy seguro
|
| 157 |
-
</button>
|
| 158 |
-
<button type="button" onclick="cancelSendRating('{{word}}')"
|
| 159 |
-
class="ct-btn-cancel-{{word}} cts-btn-general-compress py-2 px-4 cts-btn-error btn-push hidden">
|
| 160 |
-
Cancelar
|
| 161 |
-
</button>
|
| 162 |
-
</section>
|
| 163 |
-
</article>
|
| 164 |
-
</form>
|
| 165 |
-
{% endfor %}
|
| 166 |
{% elif type_scale == "estructurada" %}
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
{%
|
| 170 |
-
<article class="overflow-x-scroll w-full">
|
| 171 |
-
<article class="bg-surface-card p-6 rounded-lg mb-3 w-fit">
|
| 172 |
-
<label for="id-scale-word-{{ word }}"
|
| 173 |
-
class="text-xl font-bold tracking-wide block mb-6 first-letter:uppercase">{{ word }}</label>
|
| 174 |
-
<span class="hidden id-word">{{ word.id }}</span>
|
| 175 |
-
|
| 176 |
-
<section>
|
| 177 |
-
<div class="w-full min-w-xs">
|
| 178 |
-
<div class="relative mx-6">
|
| 179 |
-
<input type="range" min="1" max="{{scale.longitud}}" step="1" name="rating-word"
|
| 180 |
-
class="w-full range range-md text-blue-400 [--range-bg:orange] [--range-thumb:blue] [--range-fill:0] z-5">
|
| 181 |
-
<div
|
| 182 |
-
class="absolute top-0 left-0 w-full h-full z-10 flex justify-between pointer-events-none">
|
| 183 |
-
{% for tag in tags %}
|
| 184 |
-
<div class="w-0.5 transform -translate-x-1/2 h-full bg-red-500">
|
| 185 |
-
</div>
|
| 186 |
-
{% endfor %}
|
| 187 |
-
</div>
|
| 188 |
-
</div>
|
| 189 |
-
|
| 190 |
-
<div class="flex justify-between mt-4 text-xs gap-1">
|
| 191 |
-
{% for tag in tags %}
|
| 192 |
-
<div class="flex items-center justify-center text-center w-[70px]">
|
| 193 |
-
<span
|
| 194 |
-
class="text-xs font-medium text-gray-700 break-words first-letter:capitalize">
|
| 195 |
-
{{ tag.id_etiqueta }}
|
| 196 |
-
</span>
|
| 197 |
-
</div>
|
| 198 |
-
{% endfor %}
|
| 199 |
-
</div>
|
| 200 |
-
</div>
|
| 201 |
-
</section>
|
| 202 |
-
</article>
|
| 203 |
-
</article>
|
| 204 |
-
|
| 205 |
-
<article class="flex flex-col justify-center gap-2 items-end actions-{{ word }}">
|
| 206 |
-
<section class="flex justify-end items-center gap-2 btns-container">
|
| 207 |
-
<button type="button" onclick="checkSendRating('{{ word }}')"
|
| 208 |
-
class="ct-btn-check-{{ word }} cts-btn-general-compress py-2 px-4 cts-btn-secondary btn-push">
|
| 209 |
-
¿Guardar calificación?
|
| 210 |
-
</button>
|
| 211 |
-
<button type="button" onclick="sendRating('{{ word }}')"
|
| 212 |
-
class="ct-btn-submit-{{ word }} cts-btn-general-compress py-2 px-4 cts-btn-primary btn-push hidden">
|
| 213 |
-
Estoy seguro
|
| 214 |
-
</button>
|
| 215 |
-
<button type="button" onclick="cancelSendRating('{{ word }}')"
|
| 216 |
-
class="ct-btn-cancel-{{ word }} cts-btn-general-compress py-2 px-4 cts-btn-error btn-push hidden">
|
| 217 |
-
Cancelar
|
| 218 |
-
</button>
|
| 219 |
-
</section>
|
| 220 |
-
</article>
|
| 221 |
-
</form>
|
| 222 |
-
{% endfor %}
|
| 223 |
{% endif %}
|
| 224 |
</article>
|
| 225 |
</article>
|
|
|
|
| 37 |
<article class="cts-wrap-content text-black">
|
| 38 |
<header class="text-center flex-row w-full items-stretch flex justify-around flex-wrap gap-2">
|
| 39 |
<h1 class="rounded font-bold text-2xl bg-surface-ligt p-4 flex-1">
|
| 40 |
+
Sesión usando <br>técnica
|
| 41 |
+
<span class="uppercase">{{ session.tecnica.tipo_tecnica }}</span>
|
| 42 |
</h1>
|
| 43 |
<button class="cts-btn-general cts-btn-error btn-push" onclick="exit_sesion('form-actions')">
|
| 44 |
Salir de la sesión
|
|
|
|
| 46 |
</header>
|
| 47 |
|
| 48 |
<article class="hidden">
|
| 49 |
+
<form action="{% url 'cata_system:catador_init_session' code_sesion=session.codigo_sesion %}" method="post"
|
| 50 |
+
class="form-actions">
|
| 51 |
{% csrf_token %}
|
| 52 |
<input type="hidden" name="action" class="action-input">
|
| 53 |
</form>
|
|
|
|
| 98 |
<article
|
| 99 |
class="scales-container [&>*:not(:last-child)]:mb-5 min-lg:grid min-lg:items-start grid-cols-2 gap-3 justify-center items-center">
|
| 100 |
{% if type_scale == "continua" %}
|
| 101 |
+
{% for word in words %}
|
| 102 |
+
{% include "../components/form-scale-continue.html" with word=word tags=tags scale=scale %}
|
| 103 |
+
{% endfor %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
{% elif type_scale == "estructurada" %}
|
| 105 |
+
{% for word in words %}
|
| 106 |
+
{% include "../components/form-scale-structure.html" with word=word tags=tags scale=scale %}
|
| 107 |
+
{% endfor %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
{% endif %}
|
| 109 |
</article>
|
| 110 |
</article>
|
tecnicas/templates/tecnicas/forms_tester/init_session.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
|
| 6 |
{% block content %}
|
| 7 |
<article class="cts-container-main">
|
| 8 |
-
<article class="cts-wrap-content text-black">
|
| 9 |
<header class="text-center flex-row w-full flex justify-around items-center flex-wrap gap-10">
|
| 10 |
<h1 class="rounded-xl font-bold text-2xl bg-surface-ligt p-4 flex-1">
|
| 11 |
Panel principal de Catadores
|
|
|
|
| 5 |
|
| 6 |
{% block content %}
|
| 7 |
<article class="cts-container-main">
|
| 8 |
+
<article class="cts-wrap-content text-black max-w-4xl">
|
| 9 |
<header class="text-center flex-row w-full flex justify-around items-center flex-wrap gap-10">
|
| 10 |
<h1 class="rounded-xl font-bold text-2xl bg-surface-ligt p-4 flex-1">
|
| 11 |
Panel principal de Catadores
|
tecnicas/templates/tecnicas/manage_sesions/detalles-sesion.html
CHANGED
|
@@ -181,6 +181,14 @@
|
|
| 181 |
</p>
|
| 182 |
<article class="flex flex-wrap gap-10 max-sm:gap-2">
|
| 183 |
{% if not sesion.activo %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
<button
|
| 185 |
class="ct-btn-start-repition flex-1 uppercase text-lg max-sm:text-base tracking-wider p-4 border-b-2 active:border-b-0 active:border-t-2 active:border-green-500 border-green-800 transition-all rounded-xl bg-green-600 text-white font-bold disabled:bg-amber-600 flex flex-col justify-center items-center gap-2"
|
| 186 |
onclick="startRepetition()">
|
|
@@ -189,6 +197,7 @@
|
|
| 189 |
<img src="{% static 'img/giro.svg' %}" alt="flechas girando" class="invert">
|
| 190 |
</figure>
|
| 191 |
</button>
|
|
|
|
| 192 |
{% else %}
|
| 193 |
<a href="{% url 'cata_system:monitor_sesion' session_code=sesion.codigo_sesion %}" class="flex-1 w-fit">
|
| 194 |
<button
|
|
@@ -243,9 +252,11 @@
|
|
| 243 |
|
| 244 |
{% if existen_calificaciones %}
|
| 245 |
<article class="bg-surface-card p-4 max-sm:px-2 text-black rounded">
|
|
|
|
| 246 |
{% for repeticion, catadores in calificaciones.items %}
|
| 247 |
-
{% include
|
| 248 |
{% endfor %}
|
|
|
|
| 249 |
</article>
|
| 250 |
{% else %}
|
| 251 |
{% include "../components/error-message.html" with message='Sin calificaciones que mostrar aún' %}
|
|
|
|
| 181 |
</p>
|
| 182 |
<article class="flex flex-wrap gap-10 max-sm:gap-2">
|
| 183 |
{% if not sesion.activo %}
|
| 184 |
+
{% if fin_repeticiones %}
|
| 185 |
+
<div
|
| 186 |
+
class="text-2xl font-semibold flex-1 cts-btn-secondary p-4 flex justify-center items-center rounded-lg select-none text-center">
|
| 187 |
+
<p class=" text-black">
|
| 188 |
+
Máximo número de repeticiones alcanzado
|
| 189 |
+
</p>
|
| 190 |
+
</div>
|
| 191 |
+
{% else %}
|
| 192 |
<button
|
| 193 |
class="ct-btn-start-repition flex-1 uppercase text-lg max-sm:text-base tracking-wider p-4 border-b-2 active:border-b-0 active:border-t-2 active:border-green-500 border-green-800 transition-all rounded-xl bg-green-600 text-white font-bold disabled:bg-amber-600 flex flex-col justify-center items-center gap-2"
|
| 194 |
onclick="startRepetition()">
|
|
|
|
| 197 |
<img src="{% static 'img/giro.svg' %}" alt="flechas girando" class="invert">
|
| 198 |
</figure>
|
| 199 |
</button>
|
| 200 |
+
{% endif %}
|
| 201 |
{% else %}
|
| 202 |
<a href="{% url 'cata_system:monitor_sesion' session_code=sesion.codigo_sesion %}" class="flex-1 w-fit">
|
| 203 |
<button
|
|
|
|
| 252 |
|
| 253 |
{% if existen_calificaciones %}
|
| 254 |
<article class="bg-surface-card p-4 max-sm:px-2 text-black rounded">
|
| 255 |
+
{% with url_component="../components/table-convencional.html" %}
|
| 256 |
{% for repeticion, catadores in calificaciones.items %}
|
| 257 |
+
{% include url_component with repeticion=repeticion catadores=catadores palabras=palabras %}
|
| 258 |
{% endfor %}
|
| 259 |
+
{% endwith %}
|
| 260 |
</article>
|
| 261 |
{% else %}
|
| 262 |
{% include "../components/error-message.html" with message='Sin calificaciones que mostrar aún' %}
|
tecnicas/views/tester_forms/convencional_scales.py
CHANGED
|
@@ -57,7 +57,9 @@
|
|
| 57 |
from django.http import HttpRequest
|
| 58 |
from django.shortcuts import redirect, render
|
| 59 |
from django.urls import reverse
|
| 60 |
-
from
|
|
|
|
|
|
|
| 61 |
|
| 62 |
|
| 63 |
def convencionalScales(req: HttpRequest, code_sesion: str):
|
|
@@ -66,6 +68,8 @@ def convencionalScales(req: HttpRequest, code_sesion: str):
|
|
| 66 |
|
| 67 |
session = SesionController.getSessionByCode(code_sesion)
|
| 68 |
technique = session.tecnica
|
|
|
|
|
|
|
| 69 |
|
| 70 |
context = {
|
| 71 |
"session": session
|
|
@@ -92,8 +96,11 @@ def convencionalScales(req: HttpRequest, code_sesion: str):
|
|
| 92 |
|
| 93 |
if isinstance(next_position, dict):
|
| 94 |
updated_participation = ParticipacionController.finishSession(
|
| 95 |
-
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
if isinstance(next_position, list):
|
| 99 |
next_position = next_position[0]
|
|
|
|
| 57 |
from django.http import HttpRequest
|
| 58 |
from django.shortcuts import redirect, render
|
| 59 |
from django.urls import reverse
|
| 60 |
+
from urllib.parse import urlencode
|
| 61 |
+
from tecnicas.models import Participacion
|
| 62 |
+
from tecnicas.controllers import SesionController, PosicionController, CalificacionController, ParticipacionController, PalabrasController, EscalaController, DatoController
|
| 63 |
|
| 64 |
|
| 65 |
def convencionalScales(req: HttpRequest, code_sesion: str):
|
|
|
|
| 68 |
|
| 69 |
session = SesionController.getSessionByCode(code_sesion)
|
| 70 |
technique = session.tecnica
|
| 71 |
+
participation = Participacion.objects.get(
|
| 72 |
+
tecnica=technique, catador=req.user.user_catador)
|
| 73 |
|
| 74 |
context = {
|
| 75 |
"session": session
|
|
|
|
| 96 |
|
| 97 |
if isinstance(next_position, dict):
|
| 98 |
updated_participation = ParticipacionController.finishSession(
|
| 99 |
+
participation)
|
| 100 |
+
params = {
|
| 101 |
+
"code_sesion": code_sesion
|
| 102 |
+
}
|
| 103 |
+
return redirect(reverse('cata_system:catador_init_session', kwargs=params))
|
| 104 |
|
| 105 |
if isinstance(next_position, list):
|
| 106 |
next_position = next_position[0]
|
tecnicas/views/tester_forms/init_tester_form.py
CHANGED
|
@@ -7,11 +7,6 @@ from tecnicas.models import SesionSensorial
|
|
| 7 |
|
| 8 |
def initTesterForm(req: HttpRequest, code_sesion: str):
|
| 9 |
session = SesionSensorial.objects.get(codigo_sesion=code_sesion)
|
| 10 |
-
|
| 11 |
-
context = {
|
| 12 |
-
"session": session
|
| 13 |
-
}
|
| 14 |
-
|
| 15 |
type_technique = session.tecnica.tipo_tecnica.nombre_tecnica
|
| 16 |
template_url = "tecnicas/forms_tester/init_session.html"
|
| 17 |
|
|
@@ -25,6 +20,7 @@ def initTesterForm(req: HttpRequest, code_sesion: str):
|
|
| 25 |
response = view_controller.controllGetRATA(request=req)
|
| 26 |
else:
|
| 27 |
context = {
|
|
|
|
| 28 |
"error": "La técnica usada en esta sesión o ha sido implementada para ingresar a ella"
|
| 29 |
}
|
| 30 |
response = render(
|
|
@@ -36,6 +32,7 @@ def initTesterForm(req: HttpRequest, code_sesion: str):
|
|
| 36 |
response = view_controller.controllPostEscalas(request=req)
|
| 37 |
else:
|
| 38 |
context = {
|
|
|
|
| 39 |
"error": "Esta opción aun no esta disponible para la técnica usada por la sesión"
|
| 40 |
}
|
| 41 |
response = render(
|
|
|
|
| 7 |
|
| 8 |
def initTesterForm(req: HttpRequest, code_sesion: str):
|
| 9 |
session = SesionSensorial.objects.get(codigo_sesion=code_sesion)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
type_technique = session.tecnica.tipo_tecnica.nombre_tecnica
|
| 11 |
template_url = "tecnicas/forms_tester/init_session.html"
|
| 12 |
|
|
|
|
| 20 |
response = view_controller.controllGetRATA(request=req)
|
| 21 |
else:
|
| 22 |
context = {
|
| 23 |
+
"session": session,
|
| 24 |
"error": "La técnica usada en esta sesión o ha sido implementada para ingresar a ella"
|
| 25 |
}
|
| 26 |
response = render(
|
|
|
|
| 32 |
response = view_controller.controllPostEscalas(request=req)
|
| 33 |
else:
|
| 34 |
context = {
|
| 35 |
+
"session": session,
|
| 36 |
"error": "Esta opción aun no esta disponible para la técnica usada por la sesión"
|
| 37 |
}
|
| 38 |
response = render(
|