Spaces:
Sleeping
Sleeping
Se agrega eliminacion de sesiones con PF
Browse files
tecnicas/controllers/views_controller/session_management/details_controller.py
CHANGED
|
@@ -35,11 +35,11 @@ class DetallesController():
|
|
| 35 |
technique = self.session.tecnica
|
| 36 |
|
| 37 |
if creator.user.username != self.session.creadoPor.user.username:
|
| 38 |
-
return self.
|
| 39 |
elif self.session.activo:
|
| 40 |
-
return self.
|
| 41 |
elif technique.repeticion >= technique.repeticiones_max:
|
| 42 |
-
return self.
|
| 43 |
|
| 44 |
there_participacions = Participacion.objects.filter(
|
| 45 |
tecnica=technique).exists()
|
|
@@ -48,7 +48,7 @@ class DetallesController():
|
|
| 48 |
(is_update_participations,
|
| 49 |
message) = ParticipacionController.outAllInSession(self.session)
|
| 50 |
if not is_update_participations:
|
| 51 |
-
return self.
|
| 52 |
|
| 53 |
self.session.activo = True
|
| 54 |
technique.repeticion = technique.repeticion + 1
|
|
|
|
| 35 |
technique = self.session.tecnica
|
| 36 |
|
| 37 |
if creator.user.username != self.session.creadoPor.user.username:
|
| 38 |
+
return self.controllGetResponse(error="Solo el presentador que crea la sesión puede iniciar la repetición", request=request)
|
| 39 |
elif self.session.activo:
|
| 40 |
+
return self.controllGetResponse(error="La sesión ya está activada", request=request)
|
| 41 |
elif technique.repeticion >= technique.repeticiones_max:
|
| 42 |
+
return self.controllGetResponse(error="Se ha alcanzado el número de repeticiones máxima", request=request)
|
| 43 |
|
| 44 |
there_participacions = Participacion.objects.filter(
|
| 45 |
tecnica=technique).exists()
|
|
|
|
| 48 |
(is_update_participations,
|
| 49 |
message) = ParticipacionController.outAllInSession(self.session)
|
| 50 |
if not is_update_participations:
|
| 51 |
+
return self.controllGetResponse(error=message, request=request)
|
| 52 |
|
| 53 |
self.session.activo = True
|
| 54 |
technique.repeticion = technique.repeticion + 1
|
tecnicas/controllers/views_controller/session_management/details_pf_controller.py
CHANGED
|
@@ -35,36 +35,6 @@ class DetallesPFController(DetallesController):
|
|
| 35 |
|
| 36 |
return self.context
|
| 37 |
|
| 38 |
-
def startRepetition(self, presenter: Presentador, request: HttpRequest):
|
| 39 |
-
creator = presenter
|
| 40 |
-
technique = self.session.tecnica
|
| 41 |
-
|
| 42 |
-
if creator.user.username != self.session.creadoPor.user.username:
|
| 43 |
-
return self.getResponse(error="Solo el presentador que crea la sesión puede iniciar la repetición o fase", request=request)
|
| 44 |
-
elif self.session.activo:
|
| 45 |
-
return self.getResponse(error="La sesión ya está activada", request=request)
|
| 46 |
-
|
| 47 |
-
there_participacions = Participacion.objects.filter(
|
| 48 |
-
tecnica=technique).exists()
|
| 49 |
-
|
| 50 |
-
if there_participacions:
|
| 51 |
-
(is_update_participations,
|
| 52 |
-
message) = ParticipacionController.outAllInSession(self.session)
|
| 53 |
-
if not is_update_participations:
|
| 54 |
-
return self.getResponse(error=message, request=request)
|
| 55 |
-
|
| 56 |
-
self.session.activo = True
|
| 57 |
-
technique.repeticion = technique.repeticion + 1
|
| 58 |
-
|
| 59 |
-
technique.save()
|
| 60 |
-
self.session.save()
|
| 61 |
-
|
| 62 |
-
parameters = {
|
| 63 |
-
"session_code": self.session.codigo_sesion
|
| 64 |
-
}
|
| 65 |
-
return redirect(
|
| 66 |
-
reverse(self.url_next, kwargs=parameters))
|
| 67 |
-
|
| 68 |
def getDataPhases(self):
|
| 69 |
curren_repetition = self.session.tecnica.repeticion
|
| 70 |
|
|
|
|
| 35 |
|
| 36 |
return self.context
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
def getDataPhases(self):
|
| 39 |
curren_repetition = self.session.tecnica.repeticion
|
| 40 |
|
tecnicas/views/sessions_management/session_details.py
CHANGED
|
@@ -62,13 +62,24 @@ def sessionDetails(req: HttpRequest, session_code: str):
|
|
| 62 |
reverse("cata_system:panel_sesiones", kwargs={"page": 1}))
|
| 63 |
|
| 64 |
else:
|
| 65 |
-
response = controller_view.
|
| 66 |
error="No se reconoce la acción a realizar")
|
| 67 |
|
| 68 |
elif use_techinique == "perfil flash":
|
| 69 |
controller_view = DetallesPFController(session=sensorial_session)
|
| 70 |
-
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
else:
|
| 74 |
response = noValidTechnique()
|
|
|
|
| 62 |
reverse("cata_system:panel_sesiones", kwargs={"page": 1}))
|
| 63 |
|
| 64 |
else:
|
| 65 |
+
response = controller_view.controllGetResponse(
|
| 66 |
error="No se reconoce la acción a realizar")
|
| 67 |
|
| 68 |
elif use_techinique == "perfil flash":
|
| 69 |
controller_view = DetallesPFController(session=sensorial_session)
|
| 70 |
+
|
| 71 |
+
if req.POST["action"] == "start_session":
|
| 72 |
+
response = controller_view.startRepetition(
|
| 73 |
+
presenter=req.user.user_presentador, request=req)
|
| 74 |
+
|
| 75 |
+
elif req.POST.get("action") == "delete_session":
|
| 76 |
+
controller_view.deleteSesorialSession()
|
| 77 |
+
response = redirect(
|
| 78 |
+
reverse("cata_system:panel_sesiones", kwargs={"page": 1}))
|
| 79 |
+
|
| 80 |
+
else:
|
| 81 |
+
response = controller_view.controllGetResponse(
|
| 82 |
+
error="No se reconoce la acción a realizar")
|
| 83 |
|
| 84 |
else:
|
| 85 |
response = noValidTechnique()
|