chartManD commited on
Commit
74167d8
·
1 Parent(s): 4f8a4a6

Actualizado panel de detalles y monitoero de la sesion

Browse files
tecnicas/controllers/views_controller/detalles_sesion_controller.py CHANGED
@@ -69,7 +69,7 @@ class DetallesSesionController():
69
  @staticmethod
70
  def startRepetition(session_code: str, username: str):
71
  try:
72
- creator = Presentador.objects.get(nombre_usuario=username)
73
  session = SesionSensorial.objects.get(codigo_sesion=session_code)
74
  technique = Tecnica.objects.get(id=session.tecnica.id)
75
  except Presentador.DoesNotExist:
@@ -79,7 +79,7 @@ class DetallesSesionController():
79
  except Tecnica.DoesNotExist:
80
  return controller_error("Ha ocurrido un error al recuperar la técnica")
81
 
82
- if creator.nombre_usuario != session.creadoPor.nombre_usuario:
83
  return controller_error("solo el presentador que crea la sesión puede iniciar la repetición")
84
  elif session.activo:
85
  return controller_error("la sesión ya está activada")
 
69
  @staticmethod
70
  def startRepetition(session_code: str, username: str):
71
  try:
72
+ creator = Presentador.objects.get(user__username=username)
73
  session = SesionSensorial.objects.get(codigo_sesion=session_code)
74
  technique = Tecnica.objects.get(id=session.tecnica.id)
75
  except Presentador.DoesNotExist:
 
79
  except Tecnica.DoesNotExist:
80
  return controller_error("Ha ocurrido un error al recuperar la técnica")
81
 
82
+ if creator.user.username != session.creadoPor.user.username:
83
  return controller_error("solo el presentador que crea la sesión puede iniciar la repetición")
84
  elif session.activo:
85
  return controller_error("la sesión ya está activada")
tecnicas/templates/tecnicas/manage_sesions/detalles-sesion.html CHANGED
@@ -10,9 +10,11 @@
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
12
  </h1>
13
- <button class="cts-btn-general cts-btn-error btn-push" onclick="window.history.back()">
14
- Volver a las Sesiones
15
- </button>
 
 
16
  </header>
17
 
18
  {% if error %}
@@ -182,7 +184,8 @@
182
  {% if existen_calificaciones %}
183
  <article class="bg-surface-card p-4 max-sm:px-2 text-black rounded">
184
  {% for repeticion, catadores in calificaciones.items %}
185
- {% include "../components/table-convencional.html" with repeticion=repeticion catadores=catadores palabras=palabras %}
 
186
  {% endfor %}
187
  </article>
188
  {% else %}
 
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
12
  </h1>
13
+ <a href="{% url 'cata_system:panel_sesiones' page=1 %}">
14
+ <button class="cts-btn-general cts-btn-error btn-push">
15
+ Volver a las Sesiones
16
+ </button>
17
+ </a>
18
  </header>
19
 
20
  {% if error %}
 
184
  {% if existen_calificaciones %}
185
  <article class="bg-surface-card p-4 max-sm:px-2 text-black rounded">
186
  {% for repeticion, catadores in calificaciones.items %}
187
+ {% include "../components/table-convencional.html" with repeticion=repeticion catadores=catadores
188
+ palabras=palabras %}
189
  {% endfor %}
190
  </article>
191
  {% else %}
tecnicas/templates/tecnicas/manage_sesions/monitor-sesion.html CHANGED
@@ -28,10 +28,11 @@
28
  onclick="finishSession()">
29
  Finalizar sesión
30
  </button>
31
- <button class="uppercase cts-btn-general-compress cts-btn-error py-2 px-6 btn-push"
32
- onclick="window.history.back()">
33
- Regresar
34
- </button>
 
35
  </div>
36
  </section>
37
 
 
28
  onclick="finishSession()">
29
  Finalizar sesión
30
  </button>
31
+ <a href="{% url 'cata_system:detalles_sesion' session_code=code_session %}" class="w-full">
32
+ <button class="uppercase cts-btn-general-compress cts-btn-error py-2 px-6 btn-push w-full">
33
+ Regresar
34
+ </button>
35
+ </a>
36
  </div>
37
  </section>
38
 
tecnicas/views/sessions_management/session_details.py CHANGED
@@ -14,16 +14,19 @@ def sessionDetails(req: HttpRequest, session_code: str):
14
  elif req.method == "POST":
15
  if req.POST["action"] == "start_session":
16
  response = DetallesSesionController.startRepetition(
17
- session_code=session_code, username=req.POST["username"])
18
  if isinstance(response, dict):
19
  context = controller_view.getContextWithData()
20
  context["error"] = response["error"]
21
  return render(req, "tecnicas/manage_sesions/detalles-sesion.html", context)
22
- return redirect(reverse("cata_system:monitor_sesion"))
 
 
 
 
 
23
  elif req.POST.get("action") == "delete_session":
24
  pass
25
- elif req.POST.get("action") == "monitor_session":
26
- pass
27
  else:
28
  context["error"] = "no se reconoce la accion a realizar"
29
  return render(req, "tecnicas/manage_sesions/detalles-sesion.html", context)
 
14
  elif req.method == "POST":
15
  if req.POST["action"] == "start_session":
16
  response = DetallesSesionController.startRepetition(
17
+ session_code=session_code, username=req.user.username)
18
  if isinstance(response, dict):
19
  context = controller_view.getContextWithData()
20
  context["error"] = response["error"]
21
  return render(req, "tecnicas/manage_sesions/detalles-sesion.html", context)
22
+
23
+ parameters = {
24
+ "session_code": controller_view.session.codigo_sesion
25
+ }
26
+
27
+ return redirect(reverse("cata_system:monitor_sesion", kwargs=parameters))
28
  elif req.POST.get("action") == "delete_session":
29
  pass
 
 
30
  else:
31
  context["error"] = "no se reconoce la accion a realizar"
32
  return render(req, "tecnicas/manage_sesions/detalles-sesion.html", context)