chartManD commited on
Commit
e729a31
·
1 Parent(s): a5e6416

Detalles sesio con PF, mostrar datos de primera fase

Browse files
tecnicas/controllers/views_controller/session_management/details_pf_controller.py CHANGED
@@ -1,7 +1,7 @@
1
  from django.http import HttpRequest
2
  from django.shortcuts import redirect
3
  from django.urls import reverse
4
- from tecnicas.models import SesionSensorial, Presentador, Participacion
5
  from tecnicas.controllers import ParticipacionController
6
  from .details_controller import DetallesController
7
 
@@ -27,9 +27,10 @@ class DetallesPFController(DetallesController):
27
  # Definir el estado de la sesion
28
  rep = technique.repeticion
29
  activate = self.session.activo
30
-
31
  self.context["estado"] = self.getStatus(rep, activate)
32
 
 
 
33
  return self.context
34
 
35
  def startRepetition(self, presenter: Presentador, request: HttpRequest):
@@ -62,6 +63,82 @@ class DetallesPFController(DetallesController):
62
  return redirect(
63
  reverse(self.url_next, kwargs=parameters))
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  def getStatus(self, rep: int, activate: bool):
66
  status = ""
67
 
 
1
  from django.http import HttpRequest
2
  from django.shortcuts import redirect
3
  from django.urls import reverse
4
+ from tecnicas.models import SesionSensorial, Presentador, Participacion, ListaPalabras
5
  from tecnicas.controllers import ParticipacionController
6
  from .details_controller import DetallesController
7
 
 
27
  # Definir el estado de la sesion
28
  rep = technique.repeticion
29
  activate = self.session.activo
 
30
  self.context["estado"] = self.getStatus(rep, activate)
31
 
32
+ self.getDataPhases()
33
+
34
  return self.context
35
 
36
  def startRepetition(self, presenter: Presentador, request: HttpRequest):
 
63
  return redirect(
64
  reverse(self.url_next, kwargs=parameters))
65
 
66
+ def getDataPhases(self):
67
+ curren_repetition = self.session.tecnica.repeticion
68
+
69
+ if curren_repetition == 1:
70
+ self.context["fisrt_phase"] = self.getDataFirstPhase()
71
+ elif curren_repetition == 2:
72
+ self.context["fisrt_phase"] = self.getDataFirstPhase()
73
+ self.context["second_phase"] = self.getDataSecondPhase()
74
+ elif curren_repetition >= 3:
75
+ self.context["fisrt_phase"] = self.getDataFirstPhase()
76
+ self.context["second_phase"] = self.getDataSecondPhase()
77
+ self.context["data_ratings"] = self.getDataRatings()
78
+
79
+ return self.context
80
+
81
+ def getDataFirstPhase(self):
82
+ lists_testers = ListaPalabras.objects.filter(
83
+ tecnica=self.session.tecnica,
84
+ es_final=False
85
+ )
86
+
87
+ result = []
88
+ for list in lists_testers:
89
+ try:
90
+ username = list.catador.user.username
91
+ except Exception:
92
+ username = None
93
+
94
+ words_qs = list.palabras.all()
95
+ words = []
96
+ for p in words_qs:
97
+ nombre = getattr(p, 'nombre_palabra', None)
98
+ words.append({
99
+ 'id': getattr(p, 'id', None),
100
+ 'nombre_palabra': nombre
101
+ })
102
+
103
+ result.append({
104
+ 'username': username,
105
+ 'words': words
106
+ })
107
+
108
+ return result
109
+
110
+ def getDataSecondPhase(self):
111
+ lists_testers = ListaPalabras.objects.filter(
112
+ tecnica=self.session.tecnica,
113
+ es_final=True
114
+ )
115
+
116
+ result = []
117
+ for list in lists_testers:
118
+ try:
119
+ username = list.catador.user.username
120
+ except Exception:
121
+ username = None
122
+
123
+ words_qs = list.palabras.all()
124
+ words = []
125
+ for p in words_qs:
126
+ nombre = getattr(p, 'nombre_palabra', None)
127
+ words.append({
128
+ 'id': getattr(p, 'id', None),
129
+ 'nombre_palabra': nombre
130
+ })
131
+
132
+ result.append({
133
+ 'username': username,
134
+ 'words': words
135
+ })
136
+
137
+ return result
138
+
139
+ def getDataRatings(self):
140
+ return []
141
+
142
  def getStatus(self, rep: int, activate: bool):
143
  status = ""
144
 
tecnicas/templates/tecnicas/components/item-list-words.html ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <div class="cts-item-list-tester bg-surface-sweet px-4 pt-2 pb-3 rounded shrink-0 w-64 space-y-2">
2
+ <p class="bg-surface-card text-lg font-semibold text-center rounded">{{ list_tester.username }}</p>
3
+ <ul class="text-center grid grid-cols-2 gap-2 w-full">
4
+ {% for word in list_tester.words %}
5
+ <li class="bg-surface-ligt rounded font-bold py-1 px-2 truncate">{{ word.nombre_palabra }}</li>
6
+ {% endfor %}
7
+ </ul>
8
+ </div>
tecnicas/templates/tecnicas/manage_sesions/details-session-pf.html CHANGED
@@ -166,21 +166,65 @@
166
  Datos obtenidos
167
  </p>
168
 
169
- <article class="bg-surface-card p-4 max-sm:px-2 text-black rounded">
170
- <section class="text-xl space-y-4 space-x-4 mb-4">
171
- <p class="inline italic underline font-semibold">
172
- Se usa una escala <b>{{ tipo_escala }}</b> para calificar
173
- </p>
174
- <p class="inline italic underline font-semibold">
175
- El valor máximo por calificación es <b>{{ valor_max }}</b>
176
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  </section>
178
- {% if existen_calificaciones %}
179
- {% include "../components/table_cata.html" with calificaciones=calificaciones palabras=palabras
180
- sesion=sesion %}
181
- {% else %}
182
- {% include "../components/error-message.html" with message='Sin calificaciones que mostrar aún' %}
183
- {% endif %}
184
  </article>
185
 
186
  <form action="" method="post" class="form-action-session hidden">
 
166
  Datos obtenidos
167
  </p>
168
 
169
+ <article class="bg-surface-card p-4 max-sm:px-2 text-black rounded space-y-4">
170
+ <section class="">
171
+ <header class="text-center">
172
+ <h3 class="text-xl font-bold">Prmera fase</h3>
173
+ <p class="text-lg">Listas iniciales de Catadores</p>
174
+ </header>
175
+
176
+ {% if fisrt_phase %}
177
+ <article class="flex gap-4 overflow-x-auto py-2">
178
+ {% for list_tester in fisrt_phase %}
179
+ {% include "../components/item-list-words.html" with list_tester=list_tester %}
180
+ {% endfor %}
181
+ </article>
182
+ {% else %}
183
+ {% include "../components/error-message.html" with message='Sin datos por mostrar aún' %}
184
+ {% endif %}
185
+ </section>
186
+
187
+
188
+ <section class="">
189
+ <header class="text-center">
190
+ <h3 class="text-xl font-bold">Segunda fase</h3>
191
+ <p class="text-lg">Listas finales de Catadores</p>
192
+ </header>
193
+
194
+ {% if second_phase %}
195
+ <article class="flex gap-4 overflow-x-auto py-2">
196
+ {% for list_tester in second_phase %}
197
+ {% include "../components/item-list-words.html" with list_tester=list_tester %}
198
+ {% endfor %}
199
+ </article>
200
+ {% else %}
201
+ {% include "../components/error-message.html" with message='Sin datos por mostrar aún' %}
202
+ {% endif %}
203
+ </section>
204
+
205
+ <section class="">
206
+ <header class="text-center">
207
+ <h3 class="text-xl font-bold">Tercera fase</h3>
208
+ <p class="text-lg">Listas finales de Catadores</p>
209
+ </header>
210
+
211
+ <article class="text-xl space-y-4 space-x-4 mb-4">
212
+ <p class="inline italic underline font-semibold">
213
+ Se usa una escala <b>{{ tipo_escala }}</b> para calificar
214
+ </p>
215
+ <p class="inline italic underline font-semibold">
216
+ El valor máximo por calificación es <b>{{ valor_max }}</b>
217
+ </p>
218
+ </article>
219
+
220
+ {% if data_ratings %}
221
+ <article class="flex gap-4 overflow-x-auto py-2">
222
+ {% include "../components/error-message.html" with message='Muchos datos, ahhhhhhhhhhhhh' %}
223
+ </article>
224
+ {% else %}
225
+ {% include "../components/error-message.html" with message='Sin datos por mostrar aún' %}
226
+ {% endif %}
227
  </section>
 
 
 
 
 
 
228
  </article>
229
 
230
  <form action="" method="post" class="form-action-session hidden">