Spaces:
Sleeping
Sleeping
Borrado de sesion implementado para presetnador
Browse files- tecnicas/controllers/models_controller/calificacion_controller.py +1 -1
- tecnicas/controllers/models_controller/particiapacion_controller.py +7 -5
- tecnicas/controllers/models_controller/sesion_controller.py +8 -4
- tecnicas/controllers/views_controller/detalles_sesion_controller.py +5 -1
- tecnicas/controllers/views_controller/main_tester_form_controller.py +7 -8
- tecnicas/static/js/create-session.js +2 -2
- tecnicas/static/js/details-session.js +9 -15
- tecnicas/static/js/showHiddenElement.js +9 -0
- tecnicas/templates/tecnicas/manage_sesions/detalles-sesion.html +33 -3
- tecnicas/urls.py +1 -1
- tecnicas/views/sessions_management/session_details.py +2 -1
- tecnicas/views/sessions_management/sessions_panel.py +8 -13
- tecnicas/views/tester_forms/convencional_scales.py +9 -8
- tecnicas/views/tester_forms/init_tester_form.py +9 -5
tecnicas/controllers/models_controller/calificacion_controller.py
CHANGED
|
@@ -84,7 +84,7 @@ class CalificacionController():
|
|
| 84 |
elif id_tester is not None:
|
| 85 |
filters["id_catador__id"] = id_tester
|
| 86 |
elif user_tester is not None:
|
| 87 |
-
filters["
|
| 88 |
|
| 89 |
ratings = list(Calificacion.objects.filter(**filters).select_related(
|
| 90 |
"id_producto",
|
|
|
|
| 84 |
elif id_tester is not None:
|
| 85 |
filters["id_catador__id"] = id_tester
|
| 86 |
elif user_tester is not None:
|
| 87 |
+
filters["id_catador__user__username"] = user_tester
|
| 88 |
|
| 89 |
ratings = list(Calificacion.objects.filter(**filters).select_related(
|
| 90 |
"id_producto",
|
tecnicas/controllers/models_controller/particiapacion_controller.py
CHANGED
|
@@ -1,12 +1,13 @@
|
|
| 1 |
-
from ...models import Participacion, Tecnica, SesionSensorial
|
| 2 |
from ...utils import controller_error
|
| 3 |
|
| 4 |
|
| 5 |
class ParticipacionController():
|
| 6 |
@staticmethod
|
| 7 |
-
def enterSession(
|
| 8 |
try:
|
| 9 |
-
participation = Participacion.objects.get(
|
|
|
|
| 10 |
participation.finalizado = False
|
| 11 |
participation.activo = True
|
| 12 |
participation.save()
|
|
@@ -26,9 +27,10 @@ class ParticipacionController():
|
|
| 26 |
return controller_error("No se ha encontrado la participación")
|
| 27 |
|
| 28 |
@staticmethod
|
| 29 |
-
def outSession(
|
| 30 |
try:
|
| 31 |
-
participation = Participacion.objects.get(
|
|
|
|
| 32 |
participation.activo = False
|
| 33 |
participation.save()
|
| 34 |
return participation
|
|
|
|
| 1 |
+
from ...models import Participacion, Tecnica, SesionSensorial, Catador
|
| 2 |
from ...utils import controller_error
|
| 3 |
|
| 4 |
|
| 5 |
class ParticipacionController():
|
| 6 |
@staticmethod
|
| 7 |
+
def enterSession(tester: Catador, session: SesionSensorial):
|
| 8 |
try:
|
| 9 |
+
participation = Participacion.objects.get(
|
| 10 |
+
catador=tester, tecnica=session.tecnica)
|
| 11 |
participation.finalizado = False
|
| 12 |
participation.activo = True
|
| 13 |
participation.save()
|
|
|
|
| 27 |
return controller_error("No se ha encontrado la participación")
|
| 28 |
|
| 29 |
@staticmethod
|
| 30 |
+
def outSession(tester: Catador, session: SesionSensorial):
|
| 31 |
try:
|
| 32 |
+
participation = Participacion.objects.get(
|
| 33 |
+
catador=tester, tecnica=session.tecnica)
|
| 34 |
participation.activo = False
|
| 35 |
participation.save()
|
| 36 |
return participation
|
tecnicas/controllers/models_controller/sesion_controller.py
CHANGED
|
@@ -49,7 +49,7 @@ class SesionController():
|
|
| 49 |
try:
|
| 50 |
creator = Presentador.objects.get(user__username=user_name)
|
| 51 |
except Presentador.DoesNotExist:
|
| 52 |
-
return controller_error("
|
| 53 |
|
| 54 |
queryset = (
|
| 55 |
SesionSensorial.objects
|
|
@@ -75,10 +75,14 @@ class SesionController():
|
|
| 75 |
sessions_in_page = paginator.page(page)
|
| 76 |
except PageNotAnInteger:
|
| 77 |
return controller_error("índice inválido")
|
| 78 |
-
except EmptyPage:
|
| 79 |
-
return controller_error("sin registros de sesiones")
|
| 80 |
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
@staticmethod
|
| 84 |
def getSessionByCodePanelTester(code: str):
|
|
|
|
| 49 |
try:
|
| 50 |
creator = Presentador.objects.get(user__username=user_name)
|
| 51 |
except Presentador.DoesNotExist:
|
| 52 |
+
return controller_error("Presentador invalido")
|
| 53 |
|
| 54 |
queryset = (
|
| 55 |
SesionSensorial.objects
|
|
|
|
| 75 |
sessions_in_page = paginator.page(page)
|
| 76 |
except PageNotAnInteger:
|
| 77 |
return controller_error("índice inválido")
|
|
|
|
|
|
|
| 78 |
|
| 79 |
+
if not sessions_in_page.object_list:
|
| 80 |
+
return controller_error("Sin registros de sesiones")
|
| 81 |
+
|
| 82 |
+
current_page = sessions_in_page.number
|
| 83 |
+
is_last_page = not current_page < paginator.num_pages
|
| 84 |
+
|
| 85 |
+
return (sessions_in_page, is_last_page, current_page)
|
| 86 |
|
| 87 |
@staticmethod
|
| 88 |
def getSessionByCodePanelTester(code: str):
|
tecnicas/controllers/views_controller/detalles_sesion_controller.py
CHANGED
|
@@ -12,7 +12,7 @@ Encabezados de como deben de aparecer los datos juntos
|
|
| 12 |
|
| 13 |
'''
|
| 14 |
|
| 15 |
-
from ...models import SesionSensorial, Presentador, Tecnica
|
| 16 |
from .. import CalificacionController, PalabrasController
|
| 17 |
from ...utils import controller_error
|
| 18 |
from collections import defaultdict
|
|
@@ -66,6 +66,10 @@ class DetallesSesionController():
|
|
| 66 |
|
| 67 |
return self.context
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
@staticmethod
|
| 70 |
def startRepetition(session_code: str, username: str):
|
| 71 |
try:
|
|
|
|
| 12 |
|
| 13 |
'''
|
| 14 |
|
| 15 |
+
from ...models import SesionSensorial, Presentador, Tecnica
|
| 16 |
from .. import CalificacionController, PalabrasController
|
| 17 |
from ...utils import controller_error
|
| 18 |
from collections import defaultdict
|
|
|
|
| 66 |
|
| 67 |
return self.context
|
| 68 |
|
| 69 |
+
def deleteSesorialSession(self):
|
| 70 |
+
technique = Tecnica.objects.get(id=self.session.tecnica.id)
|
| 71 |
+
technique.delete()
|
| 72 |
+
|
| 73 |
@staticmethod
|
| 74 |
def startRepetition(session_code: str, username: str):
|
| 75 |
try:
|
tecnicas/controllers/views_controller/main_tester_form_controller.py
CHANGED
|
@@ -20,6 +20,8 @@ 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 |
if not orders_without_tester:
|
| 25 |
return controller_error("Las ordenes se han acabado")
|
|
@@ -33,20 +35,17 @@ class MainTesterFormController():
|
|
| 33 |
return self.order_to_assign
|
| 34 |
|
| 35 |
def checkAssignOrder(self):
|
| 36 |
-
if not self.tester or not self.session:
|
| 37 |
-
return controller_error("Atributos no establecidos")
|
| 38 |
-
|
| 39 |
try:
|
| 40 |
-
|
| 41 |
id_tecnica=self.session.tecnica, id_catador=self.tester)
|
| 42 |
-
self.order = res_order
|
| 43 |
return self.order
|
| 44 |
except Orden.DoesNotExist:
|
| 45 |
return controller_error("Catador sin orden")
|
| 46 |
|
| 47 |
-
def isEndedSession(self,
|
| 48 |
try:
|
| 49 |
-
participation = Participacion.objects.get(
|
|
|
|
| 50 |
|
| 51 |
# ////////////////////////////////////////////////////////////// #
|
| 52 |
#
|
|
@@ -76,7 +75,7 @@ class MainTesterFormController():
|
|
| 76 |
|
| 77 |
expected_ratings_repetition = num_products * num_words
|
| 78 |
|
| 79 |
-
return
|
| 80 |
else:
|
| 81 |
return participation.finalizado
|
| 82 |
except Participacion.DoesNotExist:
|
|
|
|
| 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:
|
| 27 |
return controller_error("Las ordenes se han acabado")
|
|
|
|
| 35 |
return self.order_to_assign
|
| 36 |
|
| 37 |
def checkAssignOrder(self):
|
|
|
|
|
|
|
|
|
|
| 38 |
try:
|
| 39 |
+
self.order = Orden.objects.get(
|
| 40 |
id_tecnica=self.session.tecnica, id_catador=self.tester)
|
|
|
|
| 41 |
return self.order
|
| 42 |
except Orden.DoesNotExist:
|
| 43 |
return controller_error("Catador sin orden")
|
| 44 |
|
| 45 |
+
def isEndedSession(self, repetition: int):
|
| 46 |
try:
|
| 47 |
+
participation = Participacion.objects.get(
|
| 48 |
+
catador=self.tester, tecnica=self.session.tecnica)
|
| 49 |
|
| 50 |
# ////////////////////////////////////////////////////////////// #
|
| 51 |
#
|
|
|
|
| 75 |
|
| 76 |
expected_ratings_repetition = num_products * num_words
|
| 77 |
|
| 78 |
+
return num_ratings_now >= expected_ratings_repetition
|
| 79 |
else:
|
| 80 |
return participation.finalizado
|
| 81 |
except Participacion.DoesNotExist:
|
tecnicas/static/js/create-session.js
CHANGED
|
@@ -90,7 +90,7 @@ function renderElementsResponse({
|
|
| 90 |
];
|
| 91 |
|
| 92 |
const aIndex = document.createElement("a");
|
| 93 |
-
aIndex.href = "/cata";
|
| 94 |
aIndex.textContent = "Volver al inicio";
|
| 95 |
|
| 96 |
aIndex.classList.add(
|
|
@@ -99,7 +99,7 @@ function renderElementsResponse({
|
|
| 99 |
);
|
| 100 |
|
| 101 |
const aDetails = document.createElement("a");
|
| 102 |
-
aDetails.href = `/cata/detalles-sesion/${sessionId}`;
|
| 103 |
aDetails.textContent = "Ver detalles la sesion";
|
| 104 |
|
| 105 |
aDetails.classList.add(
|
|
|
|
| 90 |
];
|
| 91 |
|
| 92 |
const aIndex = document.createElement("a");
|
| 93 |
+
aIndex.href = "/cata/presenter/";
|
| 94 |
aIndex.textContent = "Volver al inicio";
|
| 95 |
|
| 96 |
aIndex.classList.add(
|
|
|
|
| 99 |
);
|
| 100 |
|
| 101 |
const aDetails = document.createElement("a");
|
| 102 |
+
aDetails.href = `/cata/presenter/detalles-sesion/${sessionId}`;
|
| 103 |
aDetails.textContent = "Ver detalles la sesion";
|
| 104 |
|
| 105 |
aDetails.classList.add(
|
tecnicas/static/js/details-session.js
CHANGED
|
@@ -4,23 +4,17 @@ const notificationError = document.querySelector(".ct-notification-error");
|
|
| 4 |
if (notificationError) {
|
| 5 |
setTimeout(function () {
|
| 6 |
notificationError.classList.add("hidden");
|
| 7 |
-
},
|
| 8 |
}
|
| 9 |
|
| 10 |
function startRepetition() {
|
| 11 |
-
const
|
| 12 |
-
|
| 13 |
-
inputAction.name = "action";
|
| 14 |
-
inputAction.value = "start_session";
|
| 15 |
-
|
| 16 |
-
const inputUser = document.createElement("input");
|
| 17 |
-
inputUser.type = "hidden";
|
| 18 |
-
inputUser.name = "username";
|
| 19 |
-
inputUser.value = "aguBido";
|
| 20 |
-
|
| 21 |
-
actionForm.appendChild(inputAction);
|
| 22 |
-
actionForm.appendChild(inputUser);
|
| 23 |
-
|
| 24 |
-
actionForm.classList.remove("hidden");
|
| 25 |
actionForm.submit();
|
| 26 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
if (notificationError) {
|
| 5 |
setTimeout(function () {
|
| 6 |
notificationError.classList.add("hidden");
|
| 7 |
+
}, 3000);
|
| 8 |
}
|
| 9 |
|
| 10 |
function startRepetition() {
|
| 11 |
+
const input = actionForm.querySelector(".action-option")
|
| 12 |
+
input.value = "start_session";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
actionForm.submit();
|
| 14 |
}
|
| 15 |
+
|
| 16 |
+
function deleteSession() {
|
| 17 |
+
const input = actionForm.querySelector(".action-option")
|
| 18 |
+
input.value = "delete_session";
|
| 19 |
+
actionForm.submit();
|
| 20 |
+
}
|
tecnicas/static/js/showHiddenElement.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
function hiddenWarningDialog(styleClass) {
|
| 2 |
+
const element = document.querySelector(`.${styleClass}`)
|
| 3 |
+
element.classList.add("hidden")
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
function showWarningDialog(styleClass) {
|
| 7 |
+
const element = document.querySelector(`.${styleClass}`)
|
| 8 |
+
element.classList.remove("hidden")
|
| 9 |
+
}
|
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">
|
| 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
|
|
@@ -167,9 +167,9 @@
|
|
| 167 |
</button>
|
| 168 |
</a>
|
| 169 |
{% endif %}
|
| 170 |
-
|
| 171 |
<button
|
| 172 |
-
class="flex-1 uppercase text-lg cts-btn-general cts-btn-error btn-push flex flex-col justify-center items-center gap-2"
|
|
|
|
| 173 |
borrar
|
| 174 |
<figure class="w-10">
|
| 175 |
<img src="{% static 'img/basura.svg' %}" alt="bote de basura" class="invert">
|
|
@@ -177,6 +177,34 @@
|
|
| 177 |
</button>
|
| 178 |
</article>
|
| 179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
<p class="text-black font-bold text-2xl border-b-2">
|
| 181 |
Datos obtenidos
|
| 182 |
</p>
|
|
@@ -193,6 +221,7 @@
|
|
| 193 |
{% endif %}
|
| 194 |
|
| 195 |
<form action="" method="post" class="form-action-session hidden">
|
|
|
|
| 196 |
{% csrf_token %}
|
| 197 |
</form>
|
| 198 |
</article>
|
|
@@ -201,4 +230,5 @@
|
|
| 201 |
|
| 202 |
{% block extra_js %}
|
| 203 |
<script src="{% static 'js/details-session.js' %}"></script>
|
|
|
|
| 204 |
{% endblock %}
|
|
|
|
| 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
|
|
|
|
| 167 |
</button>
|
| 168 |
</a>
|
| 169 |
{% endif %}
|
|
|
|
| 170 |
<button
|
| 171 |
+
class="flex-1 uppercase text-lg cts-btn-general cts-btn-error btn-push flex flex-col justify-center items-center gap-2"
|
| 172 |
+
onclick="showWarningDialog('cts-warnig-dialog')">
|
| 173 |
borrar
|
| 174 |
<figure class="w-10">
|
| 175 |
<img src="{% static 'img/basura.svg' %}" alt="bote de basura" class="invert">
|
|
|
|
| 177 |
</button>
|
| 178 |
</article>
|
| 179 |
|
| 180 |
+
<section
|
| 181 |
+
class="absolute w-full h-full flex justify-center items-center bg-surface-alter-card/70 top-0 left-0 p-6 rounded-xl cts-warnig-dialog hidden">
|
| 182 |
+
<article class="bg-surface-card p-4 space-y-6 rounded-xl">
|
| 183 |
+
<h2 class="text-4xl text-black text-center">
|
| 184 |
+
¡¡¡Cuidado!!!
|
| 185 |
+
</h2>
|
| 186 |
+
<p class="text-2xl text-black text-center">
|
| 187 |
+
Esta acción no es reversible, si la continua también borrara todos los datos recopilados
|
| 188 |
+
relacionados a esta sesión y no podrá volver a recuperarlos
|
| 189 |
+
</p>
|
| 190 |
+
<section class="text-black font-bold text-xl space-y-4">
|
| 191 |
+
<p class="text-center">
|
| 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"
|
| 200 |
+
onclick="hiddenWarningDialog('cts-warnig-dialog')">
|
| 201 |
+
No, cancelar
|
| 202 |
+
</button>
|
| 203 |
+
</div>
|
| 204 |
+
</section>
|
| 205 |
+
</article>
|
| 206 |
+
</section>
|
| 207 |
+
|
| 208 |
<p class="text-black font-bold text-2xl border-b-2">
|
| 209 |
Datos obtenidos
|
| 210 |
</p>
|
|
|
|
| 221 |
{% endif %}
|
| 222 |
|
| 223 |
<form action="" method="post" class="form-action-session hidden">
|
| 224 |
+
<input type="hidden" name="action" class="action-option">
|
| 225 |
{% csrf_token %}
|
| 226 |
</form>
|
| 227 |
</article>
|
|
|
|
| 230 |
|
| 231 |
{% block extra_js %}
|
| 232 |
<script src="{% static 'js/details-session.js' %}"></script>
|
| 233 |
+
<script src="{% static 'js/showHiddenElement.js' %}"></script>
|
| 234 |
{% endblock %}
|
tecnicas/urls.py
CHANGED
|
@@ -94,7 +94,7 @@ urlpatterns = [
|
|
| 94 |
views.initTesterForm,
|
| 95 |
name="catador_init_session"),
|
| 96 |
|
| 97 |
-
path("testers/
|
| 98 |
views.convencionalScales,
|
| 99 |
name="session_convencional"),
|
| 100 |
|
|
|
|
| 94 |
views.initTesterForm,
|
| 95 |
name="catador_init_session"),
|
| 96 |
|
| 97 |
+
path("testers/init-session/<str:code_sesion>/convencional",
|
| 98 |
views.convencionalScales,
|
| 99 |
name="session_convencional"),
|
| 100 |
|
tecnicas/views/sessions_management/session_details.py
CHANGED
|
@@ -26,7 +26,8 @@ def sessionDetails(req: HttpRequest, session_code: str):
|
|
| 26 |
|
| 27 |
return redirect(reverse("cata_system:monitor_sesion", kwargs=parameters))
|
| 28 |
elif req.POST.get("action") == "delete_session":
|
| 29 |
-
|
|
|
|
| 30 |
else:
|
| 31 |
context["error"] = "no se reconoce la accion a realizar"
|
| 32 |
return render(req, "tecnicas/manage_sesions/detalles-sesion.html", context)
|
|
|
|
| 26 |
|
| 27 |
return redirect(reverse("cata_system:monitor_sesion", kwargs=parameters))
|
| 28 |
elif req.POST.get("action") == "delete_session":
|
| 29 |
+
controller_view.deleteSesorialSession()
|
| 30 |
+
return redirect(reverse("cata_system:panel_sesiones", kwargs={"page": 1}))
|
| 31 |
else:
|
| 32 |
context["error"] = "no se reconoce la accion a realizar"
|
| 33 |
return render(req, "tecnicas/manage_sesions/detalles-sesion.html", context)
|
tecnicas/views/sessions_management/sessions_panel.py
CHANGED
|
@@ -3,25 +3,20 @@ from django.shortcuts import render
|
|
| 3 |
from ...controllers import SesionController
|
| 4 |
|
| 5 |
|
| 6 |
-
def sesionsPanel(req:HttpRequest, page: int):
|
| 7 |
context = {"num_page": page}
|
| 8 |
|
| 9 |
-
|
| 10 |
user_name=req.user.username, page=page)
|
| 11 |
|
| 12 |
-
if isinstance(
|
| 13 |
-
context["error"] =
|
| 14 |
return render(req, "tecnicas/manage_sesions/sesiones-panel.html", context=context)
|
|
|
|
|
|
|
| 15 |
|
| 16 |
context["sessions"] = sessions_in_page
|
| 17 |
-
context["last_page"] =
|
| 18 |
-
|
| 19 |
-
number_pages = SesionController.getNumberSessionsByCreator(
|
| 20 |
-
user_name=req.user.username)
|
| 21 |
-
if isinstance(number_pages, dict):
|
| 22 |
-
context["num_paginas"] = sessions_in_page["error"]
|
| 23 |
-
return render(req, "tecnicas/manage_sesions/sesiones-panel.html", context=context)
|
| 24 |
-
|
| 25 |
-
context["num_paginas"] = number_pages
|
| 26 |
|
| 27 |
return render(req, "tecnicas/manage_sesions/sesiones-panel.html", context=context)
|
|
|
|
| 3 |
from ...controllers import SesionController
|
| 4 |
|
| 5 |
|
| 6 |
+
def sesionsPanel(req: HttpRequest, page: int):
|
| 7 |
context = {"num_page": page}
|
| 8 |
|
| 9 |
+
response = SesionController.getSessionsSavesByCretor(
|
| 10 |
user_name=req.user.username, page=page)
|
| 11 |
|
| 12 |
+
if isinstance(response, dict):
|
| 13 |
+
context["error"] = response["error"]
|
| 14 |
return render(req, "tecnicas/manage_sesions/sesiones-panel.html", context=context)
|
| 15 |
+
|
| 16 |
+
(sessions_in_page, is_last_page, current_page) = response
|
| 17 |
|
| 18 |
context["sessions"] = sessions_in_page
|
| 19 |
+
context["last_page"] = is_last_page
|
| 20 |
+
context["num_paginas"] = current_page
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
return render(req, "tecnicas/manage_sesions/sesiones-panel.html", context=context)
|
tecnicas/views/tester_forms/convencional_scales.py
CHANGED
|
@@ -1,8 +1,3 @@
|
|
| 1 |
-
from django.http import HttpRequest
|
| 2 |
-
from django.shortcuts import redirect, render
|
| 3 |
-
from django.urls import reverse
|
| 4 |
-
from ...controllers import SesionController, PosicionController, CalificacionController, ParticipacionController, PalabrasController, EscalaController, DatoController
|
| 5 |
-
|
| 6 |
'''
|
| 7 |
**** Esta vista para sesion con tecnica convencional de escalas, al entrar debe:
|
| 8 |
**** ****
|
|
@@ -59,6 +54,10 @@ from ...controllers import SesionController, PosicionController, CalificacionCon
|
|
| 59 |
- Cata longitud debe poser una marca y solo estas seran las unicas posibles respuestas
|
| 60 |
- Cata segmento en el que se divide debe tener la etiqueda correspondiente por debajo
|
| 61 |
'''
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
|
| 64 |
def convencionalScales(req: HttpRequest):
|
|
@@ -82,7 +81,7 @@ def convencionalScales(req: HttpRequest):
|
|
| 82 |
|
| 83 |
next_position = CalificacionController.checkProducsWithoutRating(
|
| 84 |
positions=sorted_positions,
|
| 85 |
-
user_cata=req.
|
| 86 |
id_technique=req.session["id_techniqe"],
|
| 87 |
repetition=session.tecnica.repeticion,
|
| 88 |
technique=technique,
|
|
@@ -112,11 +111,13 @@ def convencionalScales(req: HttpRequest):
|
|
| 112 |
elif not ratings_product:
|
| 113 |
context["words"] = words
|
| 114 |
else:
|
| 115 |
-
recoreded_data = DatoController.getRerecordedData(
|
|
|
|
| 116 |
if not recoreded_data:
|
| 117 |
context["words"] = words
|
| 118 |
else:
|
| 119 |
-
words_to_use = PalabrasController.getWordsWithoutData(
|
|
|
|
| 120 |
context["words"] = words_to_use
|
| 121 |
|
| 122 |
scale = EscalaController.getScaleByTechnique(technique=technique)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
'''
|
| 2 |
**** Esta vista para sesion con tecnica convencional de escalas, al entrar debe:
|
| 3 |
**** ****
|
|
|
|
| 54 |
- Cata longitud debe poser una marca y solo estas seran las unicas posibles respuestas
|
| 55 |
- Cata segmento en el que se divide debe tener la etiqueda correspondiente por debajo
|
| 56 |
'''
|
| 57 |
+
from django.http import HttpRequest
|
| 58 |
+
from django.shortcuts import redirect, render
|
| 59 |
+
from django.urls import reverse
|
| 60 |
+
from ...controllers import SesionController, PosicionController, CalificacionController, ParticipacionController, PalabrasController, EscalaController, DatoController
|
| 61 |
|
| 62 |
|
| 63 |
def convencionalScales(req: HttpRequest):
|
|
|
|
| 81 |
|
| 82 |
next_position = CalificacionController.checkProducsWithoutRating(
|
| 83 |
positions=sorted_positions,
|
| 84 |
+
user_cata=req.user.username,
|
| 85 |
id_technique=req.session["id_techniqe"],
|
| 86 |
repetition=session.tecnica.repeticion,
|
| 87 |
technique=technique,
|
|
|
|
| 111 |
elif not ratings_product:
|
| 112 |
context["words"] = words
|
| 113 |
else:
|
| 114 |
+
recoreded_data = DatoController.getRerecordedData(
|
| 115 |
+
ratings=ratings_product)
|
| 116 |
if not recoreded_data:
|
| 117 |
context["words"] = words
|
| 118 |
else:
|
| 119 |
+
words_to_use = PalabrasController.getWordsWithoutData(
|
| 120 |
+
recoreded_data=recoreded_data, words=words)
|
| 121 |
context["words"] = words_to_use
|
| 122 |
|
| 123 |
scale = EscalaController.getScaleByTechnique(technique=technique)
|
tecnicas/views/tester_forms/init_tester_form.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from django.http import HttpRequest, JsonResponse
|
| 2 |
from django.shortcuts import render, redirect
|
| 3 |
from django.urls import reverse
|
| 4 |
-
from
|
| 5 |
|
| 6 |
|
| 7 |
def initTesterForm(req: HttpRequest, code_sesion: str):
|
|
@@ -22,7 +22,7 @@ def initTesterForm(req: HttpRequest, code_sesion: str):
|
|
| 22 |
if not isinstance(order, dict):
|
| 23 |
req.session["id_order"] = order.id
|
| 24 |
is_end = view_controller.isEndedSession(
|
| 25 |
-
|
| 26 |
|
| 27 |
if is_end:
|
| 28 |
context["message"] = "El catador ha terminado de realizar su evaluación, espere instrucciones del presentador"
|
|
@@ -33,7 +33,7 @@ def initTesterForm(req: HttpRequest, code_sesion: str):
|
|
| 33 |
if req.POST["action"] == "start_posting":
|
| 34 |
if "id_order" in req.session:
|
| 35 |
update_participation = ParticipacionController.enterSession(
|
| 36 |
-
|
| 37 |
if isinstance(update_participation, dict):
|
| 38 |
context["error"] = update_participation["error"]
|
| 39 |
return render(req, template_url, context)
|
|
@@ -46,12 +46,16 @@ def initTesterForm(req: HttpRequest, code_sesion: str):
|
|
| 46 |
return render(req, template_url, context)
|
| 47 |
|
| 48 |
update_participation = ParticipacionController.enterSession(
|
| 49 |
-
|
| 50 |
if isinstance(update_participation, dict):
|
| 51 |
context["error"] = update_participation["error"]
|
| 52 |
return render(req, template_url, context)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
-
return redirect(reverse("cata_system:session_convencional"))
|
| 55 |
elif req.POST["action"] == "exit_session":
|
| 56 |
response = ParticipacionController.outSession(
|
| 57 |
req.session["id_participation"])
|
|
|
|
| 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 SesionController, MainTesterFormController, ParticipacionController
|
| 5 |
|
| 6 |
|
| 7 |
def initTesterForm(req: HttpRequest, code_sesion: str):
|
|
|
|
| 22 |
if not isinstance(order, dict):
|
| 23 |
req.session["id_order"] = order.id
|
| 24 |
is_end = view_controller.isEndedSession(
|
| 25 |
+
repetition=session.tecnica.repeticion)
|
| 26 |
|
| 27 |
if is_end:
|
| 28 |
context["message"] = "El catador ha terminado de realizar su evaluación, espere instrucciones del presentador"
|
|
|
|
| 33 |
if req.POST["action"] == "start_posting":
|
| 34 |
if "id_order" in req.session:
|
| 35 |
update_participation = ParticipacionController.enterSession(
|
| 36 |
+
tester=req.user.user_catador, session=session)
|
| 37 |
if isinstance(update_participation, dict):
|
| 38 |
context["error"] = update_participation["error"]
|
| 39 |
return render(req, template_url, context)
|
|
|
|
| 46 |
return render(req, template_url, context)
|
| 47 |
|
| 48 |
update_participation = ParticipacionController.enterSession(
|
| 49 |
+
tester=req.user.user_catador, session=session)
|
| 50 |
if isinstance(update_participation, dict):
|
| 51 |
context["error"] = update_participation["error"]
|
| 52 |
return render(req, template_url, context)
|
| 53 |
+
|
| 54 |
+
parameters = {
|
| 55 |
+
"code_sesion": code_sesion
|
| 56 |
+
}
|
| 57 |
|
| 58 |
+
return redirect(reverse("cata_system:session_convencional", kwargs=parameters))
|
| 59 |
elif req.POST["action"] == "exit_session":
|
| 60 |
response = ParticipacionController.outSession(
|
| 61 |
req.session["id_participation"])
|