Spaces:
Sleeping
Sleeping
Mostrado mensaje de sesion finalizada en detalles de sesion con perfil flash
Browse files
tecnicas/controllers/views_controller/session_management/details/details_pf_controller.py
CHANGED
|
@@ -6,6 +6,8 @@ from collections import defaultdict
|
|
| 6 |
|
| 7 |
|
| 8 |
class DetallesPFController(DetallesController):
|
|
|
|
|
|
|
| 9 |
def __init__(self, session: SesionSensorial):
|
| 10 |
super().__init__(session)
|
| 11 |
self.url_template = "tecnicas/manage_sesions/details-session-pf.html"
|
|
@@ -18,7 +20,7 @@ class DetallesPFController(DetallesController):
|
|
| 18 |
"sesion": self.session,
|
| 19 |
"use_technique": technique,
|
| 20 |
"tipo_escala": technique.escala_tecnica.id_tipo_escala.nombre_escala,
|
| 21 |
-
"repeticiones_max": technique.repeticiones_max -
|
| 22 |
}
|
| 23 |
|
| 24 |
# Definir el estado de la sesion
|
|
@@ -28,8 +30,15 @@ class DetallesPFController(DetallesController):
|
|
| 28 |
|
| 29 |
self.getDataPhases()
|
| 30 |
|
|
|
|
|
|
|
| 31 |
return self.context
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
def getDataPhases(self):
|
| 34 |
curren_repetition = self.session.tecnica.repeticion
|
| 35 |
|
|
@@ -46,7 +55,7 @@ class DetallesPFController(DetallesController):
|
|
| 46 |
self.context["fisrt_phase"] = self.getDataFirstPhase()
|
| 47 |
self.context["second_phase"] = self.getDataSecondPhase()
|
| 48 |
self.context["data_ratings"] = self.getDataRatings()
|
| 49 |
-
self.context["repeticion"] = self.session.tecnica.repeticion -
|
| 50 |
|
| 51 |
return self.context
|
| 52 |
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
class DetallesPFController(DetallesController):
|
| 9 |
+
skip_repetition = 2
|
| 10 |
+
|
| 11 |
def __init__(self, session: SesionSensorial):
|
| 12 |
super().__init__(session)
|
| 13 |
self.url_template = "tecnicas/manage_sesions/details-session-pf.html"
|
|
|
|
| 20 |
"sesion": self.session,
|
| 21 |
"use_technique": technique,
|
| 22 |
"tipo_escala": technique.escala_tecnica.id_tipo_escala.nombre_escala,
|
| 23 |
+
"repeticiones_max": technique.repeticiones_max - self.skip_repetition
|
| 24 |
}
|
| 25 |
|
| 26 |
# Definir el estado de la sesion
|
|
|
|
| 30 |
|
| 31 |
self.getDataPhases()
|
| 32 |
|
| 33 |
+
self.isEndSession()
|
| 34 |
+
|
| 35 |
return self.context
|
| 36 |
|
| 37 |
+
def isEndSession(self):
|
| 38 |
+
current_rep = self.session.tecnica.repeticion - self.skip_repetition
|
| 39 |
+
max_rep = self.session.tecnica.repeticiones_max - self.skip_repetition
|
| 40 |
+
self.context["finished"] = current_rep >= max_rep
|
| 41 |
+
|
| 42 |
def getDataPhases(self):
|
| 43 |
curren_repetition = self.session.tecnica.repeticion
|
| 44 |
|
|
|
|
| 55 |
self.context["fisrt_phase"] = self.getDataFirstPhase()
|
| 56 |
self.context["second_phase"] = self.getDataSecondPhase()
|
| 57 |
self.context["data_ratings"] = self.getDataRatings()
|
| 58 |
+
self.context["repeticion"] = self.session.tecnica.repeticion - self.skip_repetition
|
| 59 |
|
| 60 |
return self.context
|
| 61 |
|
tecnicas/templates/tecnicas/manage_sesions/details-session-pf.html
CHANGED
|
@@ -120,6 +120,14 @@
|
|
| 120 |
</p>
|
| 121 |
<article class="flex flex-wrap gap-10 max-sm:gap-2">
|
| 122 |
{% if not sesion.activo %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
<button
|
| 124 |
class="ct-btn-start-repition flex-1 uppercase text-lg max-sm:text-base tracking-wider p-4 border-b-2 active:border-b-0 active:border-t-2 active:border-green-500 border-green-800 transition-all rounded-xl bg-green-600 text-white font-bold disabled:bg-amber-600 flex flex-col justify-center items-center gap-2"
|
| 125 |
onclick="startRepetition()">
|
|
@@ -128,6 +136,7 @@
|
|
| 128 |
<img src="{% static 'img/giro.svg' %}" alt="flechas girando" class="invert">
|
| 129 |
</figure>
|
| 130 |
</button>
|
|
|
|
| 131 |
{% else %}
|
| 132 |
<a href="{% url 'cata_system:monitor_sesion' session_code=sesion.codigo_sesion %}" class="flex-1 w-fit">
|
| 133 |
<button
|
|
@@ -232,31 +241,31 @@
|
|
| 232 |
</article>
|
| 233 |
|
| 234 |
{% if repeticion == 1 %}
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
{% else %}
|
| 238 |
-
{% include "../components/error-message.html" with message='Sin datos por mostrar aún' %}
|
| 239 |
-
{% endif %}
|
| 240 |
{% else %}
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
|
|
|
|
|
|
|
|
|
| 260 |
{% endif %}
|
| 261 |
</section>
|
| 262 |
</article>
|
|
|
|
| 120 |
</p>
|
| 121 |
<article class="flex flex-wrap gap-10 max-sm:gap-2">
|
| 122 |
{% if not sesion.activo %}
|
| 123 |
+
{% if finished %}
|
| 124 |
+
<div
|
| 125 |
+
class="text-2xl font-semibold flex-1 cts-btn-secondary p-4 flex justify-center items-center rounded-lg select-none text-center">
|
| 126 |
+
<p class=" text-black">
|
| 127 |
+
Sesión finalizada
|
| 128 |
+
</p>
|
| 129 |
+
</div>
|
| 130 |
+
{% else %}
|
| 131 |
<button
|
| 132 |
class="ct-btn-start-repition flex-1 uppercase text-lg max-sm:text-base tracking-wider p-4 border-b-2 active:border-b-0 active:border-t-2 active:border-green-500 border-green-800 transition-all rounded-xl bg-green-600 text-white font-bold disabled:bg-amber-600 flex flex-col justify-center items-center gap-2"
|
| 133 |
onclick="startRepetition()">
|
|
|
|
| 136 |
<img src="{% static 'img/giro.svg' %}" alt="flechas girando" class="invert">
|
| 137 |
</figure>
|
| 138 |
</button>
|
| 139 |
+
{% endif %}
|
| 140 |
{% else %}
|
| 141 |
<a href="{% url 'cata_system:monitor_sesion' session_code=sesion.codigo_sesion %}" class="flex-1 w-fit">
|
| 142 |
<button
|
|
|
|
| 241 |
</article>
|
| 242 |
|
| 243 |
{% if repeticion == 1 %}
|
| 244 |
+
{% if data_ratings %}
|
| 245 |
+
{% include "../components/table_pf_all.html" with second_phase=second_phase data_ratings=data_ratings %}
|
|
|
|
|
|
|
|
|
|
| 246 |
{% else %}
|
| 247 |
+
{% include "../components/error-message.html" with message='Sin datos por mostrar aún' %}
|
| 248 |
+
{% endif %}
|
| 249 |
+
{% else %}
|
| 250 |
+
{% if data_ratings %}
|
| 251 |
+
<article class="overflow-x-auto py-2 space-y-4">
|
| 252 |
+
{% for data_tester in data_ratings %}
|
| 253 |
+
{% include "../components/table_pf.html" with data=data_tester session_name=sesion.nombre_sesion session_code=sesion.codigo_sesion %}
|
| 254 |
+
{% endfor %}
|
| 255 |
+
</article>
|
| 256 |
+
<div class="flex justify-end mt-3 gap-4 flex-wrap">
|
| 257 |
+
<button id="download-csv-btn" class="cts-btn-general cts-btn-primary btn-push">
|
| 258 |
+
Descargar datos CSV en zip
|
| 259 |
+
</button>
|
| 260 |
+
<button id="download-xls-btn" class="cts-btn-general cts-btn-primary btn-push">
|
| 261 |
+
Descargar datos en XLSX
|
| 262 |
+
</button>
|
| 263 |
+
</div>
|
| 264 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
|
| 265 |
+
<script src="{% static 'js/download-table-xlsx.js' %}"></script>
|
| 266 |
+
{% else %}
|
| 267 |
+
{% include "../components/error-message.html" with message='Sin datos por mostrar aún' %}
|
| 268 |
+
{% endif %}
|
| 269 |
{% endif %}
|
| 270 |
</section>
|
| 271 |
</article>
|