Spaces:
Sleeping
Sleeping
Creacion de boton monitoreo en desatalles de la sesion
Browse files
tecnicas/controllers/detalles_sesion_controller.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from ..models import SesionSensorial, Presentador
|
| 2 |
from . import CalificacionController, PalabrasController
|
| 3 |
from ..utils import controller_error
|
| 4 |
|
|
@@ -25,22 +25,25 @@ class DetallesSesionController():
|
|
| 25 |
try:
|
| 26 |
creator = Presentador.objects.get(nombre_usuario=username)
|
| 27 |
session = SesionSensorial.objects.get(codigo_sesion=session_code)
|
|
|
|
| 28 |
except Presentador.DoesNotExist:
|
| 29 |
return controller_error("no existe presentador")
|
| 30 |
except SesionSensorial.DoesNotExist:
|
| 31 |
return controller_error("no existe sesión sensorial")
|
|
|
|
|
|
|
| 32 |
|
| 33 |
if creator.nombre_usuario != session.creadoPor.nombre_usuario:
|
| 34 |
return controller_error("solo el presentador que crea la sesión puede iniciar la repetición")
|
| 35 |
elif session.activo:
|
| 36 |
return controller_error("la sesión ya está activada")
|
| 37 |
-
elif
|
| 38 |
return controller_error("se ha alcanzado el número de repeticiones máxima")
|
| 39 |
|
| 40 |
session.activo = True
|
| 41 |
-
|
| 42 |
-
session.tecnica.repecion = rep + 1
|
| 43 |
|
|
|
|
| 44 |
session.save()
|
| 45 |
-
|
| 46 |
return session
|
|
|
|
| 1 |
+
from ..models import SesionSensorial, Presentador, Tecnica
|
| 2 |
from . import CalificacionController, PalabrasController
|
| 3 |
from ..utils import controller_error
|
| 4 |
|
|
|
|
| 25 |
try:
|
| 26 |
creator = Presentador.objects.get(nombre_usuario=username)
|
| 27 |
session = SesionSensorial.objects.get(codigo_sesion=session_code)
|
| 28 |
+
technique = Tecnica.objects.get(id=session.tecnica.id)
|
| 29 |
except Presentador.DoesNotExist:
|
| 30 |
return controller_error("no existe presentador")
|
| 31 |
except SesionSensorial.DoesNotExist:
|
| 32 |
return controller_error("no existe sesión sensorial")
|
| 33 |
+
except Tecnica.DoesNotExist:
|
| 34 |
+
return controller_error("Ha ocurrido un error al recuperar la técnica")
|
| 35 |
|
| 36 |
if creator.nombre_usuario != session.creadoPor.nombre_usuario:
|
| 37 |
return controller_error("solo el presentador que crea la sesión puede iniciar la repetición")
|
| 38 |
elif session.activo:
|
| 39 |
return controller_error("la sesión ya está activada")
|
| 40 |
+
elif technique.repecion == technique.repeticiones_max:
|
| 41 |
return controller_error("se ha alcanzado el número de repeticiones máxima")
|
| 42 |
|
| 43 |
session.activo = True
|
| 44 |
+
technique.repecion = technique.repecion + 1
|
|
|
|
| 45 |
|
| 46 |
+
technique.save()
|
| 47 |
session.save()
|
| 48 |
+
|
| 49 |
return session
|
tecnicas/models/sesion_sensorial.py
CHANGED
|
@@ -17,4 +17,4 @@ class SesionSensorial(models.Model):
|
|
| 17 |
Tecnica, on_delete=models.CASCADE, related_name="sesion_tecnica")
|
| 18 |
|
| 19 |
def __str__(self):
|
| 20 |
-
return self.codigo_sesion
|
|
|
|
| 17 |
Tecnica, on_delete=models.CASCADE, related_name="sesion_tecnica")
|
| 18 |
|
| 19 |
def __str__(self):
|
| 20 |
+
return self.nombre_sesion if self.nombre_sesion else self.codigo_sesion
|
tecnicas/static/img/monitor.svg
ADDED
|
|
tecnicas/templates/tecnicas/manage_sesions/detalles-sesion.html
CHANGED
|
@@ -29,7 +29,7 @@
|
|
| 29 |
{% if message %}
|
| 30 |
<article class="bg-green-600 p-4 text-white rounded-xl ct-notification-error">
|
| 31 |
<p class="block font-sans text-white text-xl antialiased font-bold uppercase tracking-wider text-center">
|
| 32 |
-
{{
|
| 33 |
</p>
|
| 34 |
</article>
|
| 35 |
{% endif %}
|
|
@@ -162,7 +162,7 @@
|
|
| 162 |
class="ct-btn-start-repition flex-1 uppercase text-lg tracking-wider p-4 border-b-2 active:border-b-0 active:border-t-2 active:border-orange-500 border-orange-800 transition-all rounded-xl bg-orange-600 text-white font-bold disabled:bg-amber-600 flex flex-col justify-center items-center gap-2">
|
| 163 |
Monitorear repetición
|
| 164 |
<figure class="w-10">
|
| 165 |
-
<img src="{% static 'img/
|
| 166 |
</figure>
|
| 167 |
</button>
|
| 168 |
{% endif %}
|
|
|
|
| 29 |
{% if message %}
|
| 30 |
<article class="bg-green-600 p-4 text-white rounded-xl ct-notification-error">
|
| 31 |
<p class="block font-sans text-white text-xl antialiased font-bold uppercase tracking-wider text-center">
|
| 32 |
+
{{ message }}
|
| 33 |
</p>
|
| 34 |
</article>
|
| 35 |
{% endif %}
|
|
|
|
| 162 |
class="ct-btn-start-repition flex-1 uppercase text-lg tracking-wider p-4 border-b-2 active:border-b-0 active:border-t-2 active:border-orange-500 border-orange-800 transition-all rounded-xl bg-orange-600 text-white font-bold disabled:bg-amber-600 flex flex-col justify-center items-center gap-2">
|
| 163 |
Monitorear repetición
|
| 164 |
<figure class="w-10">
|
| 165 |
+
<img src="{% static 'img/monitor.svg' %}" alt="flechas girando" class="invert">
|
| 166 |
</figure>
|
| 167 |
</button>
|
| 168 |
{% endif %}
|