Spaces:
Sleeping
Sleeping
Se corrigen errores al participar en sesion, monitoreo y detalles de sesion
Browse files- tecnicas/controllers/models_controller/dato_controller.py +1 -1
- tecnicas/middlewares/presenter_middleware.py +2 -3
- tecnicas/middlewares/tester_middleware.py +1 -26
- tecnicas/templates/tecnicas/components/table-convencional.html +0 -1
- tecnicas/templates/tecnicas/forms_tester/convencional.html +1 -1
- tecnicas/templates/tecnicas/manage_sesions/detalles-sesion.html +1 -2
- tecnicas/templates/tecnicas/manage_sesions/monitor-sesion.html +3 -3
- tecnicas/views/apis/rating_word.py +2 -2
- tecnicas/views/tester_forms/convencional_scales.py +6 -4
- tecnicas/views/tester_forms/init_tester_form.py +14 -6
- tecnicas/views/tester_forms/login_session.py +1 -9
tecnicas/controllers/models_controller/dato_controller.py
CHANGED
|
@@ -89,7 +89,7 @@ class DatoController():
|
|
| 89 |
producto_code=F(
|
| 90 |
"id_dato__id_calificacion__id_producto__codigoProducto"),
|
| 91 |
usuarioCatador=F(
|
| 92 |
-
"
|
| 93 |
dato_valor=F("valor")
|
| 94 |
)
|
| 95 |
)
|
|
|
|
| 89 |
producto_code=F(
|
| 90 |
"id_dato__id_calificacion__id_producto__codigoProducto"),
|
| 91 |
usuarioCatador=F(
|
| 92 |
+
"id_dato__id_calificacion__id_catador__user__username"),
|
| 93 |
dato_valor=F("valor")
|
| 94 |
)
|
| 95 |
)
|
tecnicas/middlewares/presenter_middleware.py
CHANGED
|
@@ -1,18 +1,17 @@
|
|
| 1 |
-
from django.core.exceptions import PermissionDenied
|
| 2 |
-
|
| 3 |
class PresenterAccessMiddleware:
|
| 4 |
def __init__(self, get_response):
|
| 5 |
self.get_response = get_response
|
| 6 |
|
| 7 |
def __call__(self, request):
|
| 8 |
path = request.path_info
|
| 9 |
-
|
| 10 |
if path.startswith('/cata/presenter/'):
|
| 11 |
if not request.user.is_authenticated:
|
| 12 |
from django.shortcuts import redirect
|
| 13 |
return redirect("cata_system:autenticacion")
|
| 14 |
|
| 15 |
if not hasattr(request.user, 'user_presentador'):
|
|
|
|
| 16 |
return redirect("cata_system:autenticacion")
|
| 17 |
|
| 18 |
return self.get_response(request)
|
|
|
|
|
|
|
|
|
|
| 1 |
class PresenterAccessMiddleware:
|
| 2 |
def __init__(self, get_response):
|
| 3 |
self.get_response = get_response
|
| 4 |
|
| 5 |
def __call__(self, request):
|
| 6 |
path = request.path_info
|
| 7 |
+
|
| 8 |
if path.startswith('/cata/presenter/'):
|
| 9 |
if not request.user.is_authenticated:
|
| 10 |
from django.shortcuts import redirect
|
| 11 |
return redirect("cata_system:autenticacion")
|
| 12 |
|
| 13 |
if not hasattr(request.user, 'user_presentador'):
|
| 14 |
+
from django.shortcuts import redirect
|
| 15 |
return redirect("cata_system:autenticacion")
|
| 16 |
|
| 17 |
return self.get_response(request)
|
tecnicas/middlewares/tester_middleware.py
CHANGED
|
@@ -15,32 +15,7 @@ class TesterAccessMiddleware:
|
|
| 15 |
return redirect("cata_system:catador_login")
|
| 16 |
|
| 17 |
if not hasattr(request.user, 'user_catador'):
|
|
|
|
| 18 |
return redirect("cata_system:catador_login")
|
| 19 |
|
| 20 |
return self.get_response(request)
|
| 21 |
-
|
| 22 |
-
# from django.http import HttpRequest
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
# class LoginTesterMiddleware():
|
| 26 |
-
# def __init__(self, get_response):
|
| 27 |
-
# self.get_response = get_response
|
| 28 |
-
|
| 29 |
-
# def __call__(self, req: HttpRequest):
|
| 30 |
-
# base_url_protected = "/cata/testers/"
|
| 31 |
-
|
| 32 |
-
# if req.path.startswith(base_url_protected):
|
| 33 |
-
# if not "cata_username" in req.session:
|
| 34 |
-
# id_participacion = req.COOKIES.get("id_participacion")
|
| 35 |
-
# if id_participacion:
|
| 36 |
-
# from tecnicas.controllers import ParticipacionController
|
| 37 |
-
# ParticipacionController.outSession(id_participacion)
|
| 38 |
-
# from django.shortcuts import redirect
|
| 39 |
-
# from django.urls import reverse
|
| 40 |
-
# response = redirect(reverse("cata_system:catador_login"))
|
| 41 |
-
# response.delete_cookie("id_participacion")
|
| 42 |
-
# return response
|
| 43 |
-
|
| 44 |
-
# response = self.get_response(req)
|
| 45 |
-
|
| 46 |
-
# return response
|
|
|
|
| 15 |
return redirect("cata_system:catador_login")
|
| 16 |
|
| 17 |
if not hasattr(request.user, 'user_catador'):
|
| 18 |
+
from django.shortcuts import redirect
|
| 19 |
return redirect("cata_system:catador_login")
|
| 20 |
|
| 21 |
return self.get_response(request)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tecnicas/templates/tecnicas/components/table-convencional.html
CHANGED
|
@@ -23,7 +23,6 @@
|
|
| 23 |
{% with match=None %}
|
| 24 |
{% for valor in valores %}
|
| 25 |
{% if valor.nombre_palabra == palabra %}
|
| 26 |
-
{{ palabra }} <br>
|
| 27 |
{{ valor.dato_valor }}
|
| 28 |
{% with match=True %}{% endwith %}
|
| 29 |
{% endif %}
|
|
|
|
| 23 |
{% with match=None %}
|
| 24 |
{% for valor in valores %}
|
| 25 |
{% if valor.nombre_palabra == palabra %}
|
|
|
|
| 26 |
{{ valor.dato_valor }}
|
| 27 |
{% with match=True %}{% endwith %}
|
| 28 |
{% endif %}
|
tecnicas/templates/tecnicas/forms_tester/convencional.html
CHANGED
|
@@ -45,7 +45,7 @@
|
|
| 45 |
</header>
|
| 46 |
|
| 47 |
<article class="hidden">
|
| 48 |
-
<form action="{% url 'cata_system:
|
| 49 |
{% csrf_token %}
|
| 50 |
<input type="hidden" name="action" class="action-input">
|
| 51 |
</form>
|
|
|
|
| 45 |
</header>
|
| 46 |
|
| 47 |
<article class="hidden">
|
| 48 |
+
<form action="{% url 'cata_system:catador_init_session' code_sesion=session.codigo_sesion %}" method="post" class="form-actions">
|
| 49 |
{% csrf_token %}
|
| 50 |
<input type="hidden" name="action" class="action-input">
|
| 51 |
</form>
|
tecnicas/templates/tecnicas/manage_sesions/detalles-sesion.html
CHANGED
|
@@ -212,8 +212,7 @@
|
|
| 212 |
{% if existen_calificaciones %}
|
| 213 |
<article class="bg-surface-card p-4 max-sm:px-2 text-black rounded">
|
| 214 |
{% for repeticion, catadores in calificaciones.items %}
|
| 215 |
-
{% include "../components/table-convencional.html" with repeticion=repeticion catadores=catadores
|
| 216 |
-
palabras=palabras %}
|
| 217 |
{% endfor %}
|
| 218 |
</article>
|
| 219 |
{% else %}
|
|
|
|
| 212 |
{% if existen_calificaciones %}
|
| 213 |
<article class="bg-surface-card p-4 max-sm:px-2 text-black rounded">
|
| 214 |
{% for repeticion, catadores in calificaciones.items %}
|
| 215 |
+
{% include "../components/table-convencional.html" with repeticion=repeticion catadores=catadores palabras=palabras %}
|
|
|
|
| 216 |
{% endfor %}
|
| 217 |
</article>
|
| 218 |
{% else %}
|
tecnicas/templates/tecnicas/manage_sesions/monitor-sesion.html
CHANGED
|
@@ -91,10 +91,10 @@
|
|
| 91 |
<ul class="divide-y divide-gray-400 max-sm:w-full text-black">
|
| 92 |
{% for parti in participations %}
|
| 93 |
<li class="grid grid-cols-4 text-center bg-surface-card py-2 [&_>*]:px-2">
|
| 94 |
-
<p class="border-r border-gray-400">{{ parti.catador.
|
| 95 |
<p class="border-r border-gray-400">
|
| 96 |
-
{{ parti.catador.
|
| 97 |
-
{{ parti.catador.
|
| 98 |
</p>
|
| 99 |
|
| 100 |
{% if parti.activo %}
|
|
|
|
| 91 |
<ul class="divide-y divide-gray-400 max-sm:w-full text-black">
|
| 92 |
{% for parti in participations %}
|
| 93 |
<li class="grid grid-cols-4 text-center bg-surface-card py-2 [&_>*]:px-2">
|
| 94 |
+
<p class="border-r border-gray-400">{{ parti.catador.user.username }}</p>
|
| 95 |
<p class="border-r border-gray-400">
|
| 96 |
+
{{ parti.catador.user.first_name }}
|
| 97 |
+
{{ parti.catador.user.last_name}}
|
| 98 |
</p>
|
| 99 |
|
| 100 |
{% if parti.activo %}
|
tecnicas/views/apis/rating_word.py
CHANGED
|
@@ -44,9 +44,9 @@ def reatingWord(req: HttpRequest):
|
|
| 44 |
|
| 45 |
view_controller = ApiRatingController(
|
| 46 |
rating_controller=CalificacionController(
|
| 47 |
-
technique=req.session["
|
| 48 |
product=received_id_product,
|
| 49 |
-
tester=req.
|
| 50 |
),
|
| 51 |
data_controller=DatoController(
|
| 52 |
word=received_id_word,
|
|
|
|
| 44 |
|
| 45 |
view_controller = ApiRatingController(
|
| 46 |
rating_controller=CalificacionController(
|
| 47 |
+
technique=req.session["id_technique"],
|
| 48 |
product=received_id_product,
|
| 49 |
+
tester=req.user.user_catador
|
| 50 |
),
|
| 51 |
data_controller=DatoController(
|
| 52 |
word=received_id_word,
|
tecnicas/views/tester_forms/convencional_scales.py
CHANGED
|
@@ -60,17 +60,19 @@ from django.urls import reverse
|
|
| 60 |
from ...controllers import SesionController, PosicionController, CalificacionController, ParticipacionController, PalabrasController, EscalaController, DatoController
|
| 61 |
|
| 62 |
|
| 63 |
-
def convencionalScales(req: HttpRequest):
|
| 64 |
if not "id_order" in req.session:
|
| 65 |
return redirect(reverse("cata_system:catador_main"))
|
| 66 |
|
| 67 |
-
session = SesionController.getSessionByCode(
|
| 68 |
technique = session.tecnica
|
| 69 |
|
| 70 |
context = {
|
| 71 |
"session": session
|
| 72 |
}
|
| 73 |
|
|
|
|
|
|
|
| 74 |
if req.method == "GET":
|
| 75 |
positions = PosicionController.getPostionsInOrder(
|
| 76 |
id_order=req.session["id_order"])
|
|
@@ -82,7 +84,7 @@ def convencionalScales(req: HttpRequest):
|
|
| 82 |
next_position = CalificacionController.checkProducsWithoutRating(
|
| 83 |
positions=sorted_positions,
|
| 84 |
user_cata=req.user.username,
|
| 85 |
-
id_technique=
|
| 86 |
repetition=session.tecnica.repeticion,
|
| 87 |
technique=technique,
|
| 88 |
num_words=len(words)
|
|
@@ -102,7 +104,7 @@ def convencionalScales(req: HttpRequest):
|
|
| 102 |
technique=technique,
|
| 103 |
product=next_position.id_producto,
|
| 104 |
repetition=technique.repeticion,
|
| 105 |
-
user_tester=req.
|
| 106 |
)
|
| 107 |
|
| 108 |
if isinstance(ratings_product, dict):
|
|
|
|
| 60 |
from ...controllers import SesionController, PosicionController, CalificacionController, ParticipacionController, PalabrasController, EscalaController, DatoController
|
| 61 |
|
| 62 |
|
| 63 |
+
def convencionalScales(req: HttpRequest, code_sesion: str):
|
| 64 |
if not "id_order" in req.session:
|
| 65 |
return redirect(reverse("cata_system:catador_main"))
|
| 66 |
|
| 67 |
+
session = SesionController.getSessionByCode(code_sesion)
|
| 68 |
technique = session.tecnica
|
| 69 |
|
| 70 |
context = {
|
| 71 |
"session": session
|
| 72 |
}
|
| 73 |
|
| 74 |
+
req.session["id_technique"] = session.tecnica.id
|
| 75 |
+
|
| 76 |
if req.method == "GET":
|
| 77 |
positions = PosicionController.getPostionsInOrder(
|
| 78 |
id_order=req.session["id_order"])
|
|
|
|
| 84 |
next_position = CalificacionController.checkProducsWithoutRating(
|
| 85 |
positions=sorted_positions,
|
| 86 |
user_cata=req.user.username,
|
| 87 |
+
id_technique=session.tecnica.id,
|
| 88 |
repetition=session.tecnica.repeticion,
|
| 89 |
technique=technique,
|
| 90 |
num_words=len(words)
|
|
|
|
| 104 |
technique=technique,
|
| 105 |
product=next_position.id_producto,
|
| 106 |
repetition=technique.repeticion,
|
| 107 |
+
user_tester=req.user.username
|
| 108 |
)
|
| 109 |
|
| 110 |
if isinstance(ratings_product, dict):
|
tecnicas/views/tester_forms/init_tester_form.py
CHANGED
|
@@ -31,6 +31,10 @@ def initTesterForm(req: HttpRequest, code_sesion: str):
|
|
| 31 |
return render(req, template_url, context)
|
| 32 |
elif req.method == "POST":
|
| 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)
|
|
@@ -38,7 +42,7 @@ def initTesterForm(req: HttpRequest, code_sesion: str):
|
|
| 38 |
context["error"] = update_participation["error"]
|
| 39 |
return render(req, template_url, context)
|
| 40 |
|
| 41 |
-
return redirect(reverse("cata_system:session_convencional"))
|
| 42 |
|
| 43 |
order = view_controller.assignOrder()
|
| 44 |
if isinstance(order, dict):
|
|
@@ -50,15 +54,11 @@ def initTesterForm(req: HttpRequest, code_sesion: str):
|
|
| 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
|
| 62 |
if isinstance(response, dict):
|
| 63 |
context["error"] = response["error"]
|
| 64 |
return render(req, template_url, context)
|
|
@@ -67,3 +67,11 @@ def initTesterForm(req: HttpRequest, code_sesion: str):
|
|
| 67 |
return render(req, template_url, context)
|
| 68 |
else:
|
| 69 |
return JsonResponse({"error": "metodo no permitido"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
return render(req, template_url, context)
|
| 32 |
elif req.method == "POST":
|
| 33 |
if req.POST["action"] == "start_posting":
|
| 34 |
+
parameters = {
|
| 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)
|
|
|
|
| 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):
|
|
|
|
| 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(
|
| 61 |
+
tester=req.user.user_catador, session=session)
|
| 62 |
if isinstance(response, dict):
|
| 63 |
context["error"] = response["error"]
|
| 64 |
return render(req, template_url, context)
|
|
|
|
| 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)
|
tecnicas/views/tester_forms/login_session.py
CHANGED
|
@@ -33,15 +33,7 @@ def loginSessionTester(req: HttpRequest):
|
|
| 33 |
params = {
|
| 34 |
"code_sesion": session_code
|
| 35 |
}
|
| 36 |
-
|
| 37 |
return redirect(reverse("cata_system:catador_init_session", kwargs=params))
|
| 38 |
else:
|
| 39 |
return JsonResponse({"message": "Método no valido"})
|
| 40 |
-
|
| 41 |
-
# req.session["cata_username"] = tester_user
|
| 42 |
-
# req.session["id_cata"] = tester.id
|
| 43 |
-
# req.session["code_session"] = session_code
|
| 44 |
-
# req.session["id_techniqe"] = session.tecnica.id
|
| 45 |
-
# req.session["id_participation"] = taster_participation.id
|
| 46 |
-
|
| 47 |
-
# response.set_cookie('id_participacion', taster_participation.id, max_age=60*60*24)
|
|
|
|
| 33 |
params = {
|
| 34 |
"code_sesion": session_code
|
| 35 |
}
|
| 36 |
+
|
| 37 |
return redirect(reverse("cata_system:catador_init_session", kwargs=params))
|
| 38 |
else:
|
| 39 |
return JsonResponse({"message": "Método no valido"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|