chartManD commited on
Commit
f753282
·
1 Parent(s): e1fc7f3

Correccion de bug al terminar de calificar productos

Browse files
tecnicas/controllers/views_controller/main_tester_form_controller.py CHANGED
@@ -51,6 +51,14 @@ class MainTesterFormController():
51
  try:
52
  participation = Participacion.objects.get(id=id_participation)
53
 
 
 
 
 
 
 
 
 
54
  if participation.finalizado:
55
  num_products = Producto.objects.filter(
56
  id_tecnica=self.session.tecnica).count()
@@ -60,20 +68,18 @@ class MainTesterFormController():
60
  num_words: int
61
 
62
  if style_words.nombre_estilo == "atributos":
63
- e_atribues = EsAtributo.objects.get(
64
- id_tecnica=self.session.tecnica)
65
- num_words = e_atribues.palabras.count()
66
  elif style_words.nombre_estilo == "vocabulario":
67
- e_vocabulary = EsVocabulario.objects.get(
68
- id_tecnica=self.session.tecnica)
69
- num_words = e_vocabulary.id_vocabulario.palabras.count()
70
 
71
  num_ratings_now = Calificacion.objects.filter(
72
  id_tecnica=self.session.tecnica, id_catador=self.tester, num_repeticion=repetition).count()
73
 
74
- num_ratings_max_by_tester = num_products * num_words
75
 
76
- return not num_ratings_now <= num_ratings_max_by_tester
77
  else:
78
  return participation.finalizado
79
  except Participacion.DoesNotExist:
 
51
  try:
52
  participation = Participacion.objects.get(id=id_participation)
53
 
54
+ # ////////////////////////////////////////////////////////////// #
55
+ #
56
+ # Si numero_calificaciones_esperadas = productos * palabras
57
+ # Es igual a numero_calificaciones_actuales en la repetcion R
58
+ # Ha terminado la repeticion
59
+ #
60
+ # ////////////////////////////////////////////////////////////// #
61
+
62
  if participation.finalizado:
63
  num_products = Producto.objects.filter(
64
  id_tecnica=self.session.tecnica).count()
 
68
  num_words: int
69
 
70
  if style_words.nombre_estilo == "atributos":
71
+ num_words = EsAtributo.objects.get(
72
+ id_tecnica=self.session.tecnica).palabras.count()
 
73
  elif style_words.nombre_estilo == "vocabulario":
74
+ num_words = EsVocabulario.objects.get(
75
+ id_tecnica=self.session.tecnica).id_vocabulario.palabras.count()
 
76
 
77
  num_ratings_now = Calificacion.objects.filter(
78
  id_tecnica=self.session.tecnica, id_catador=self.tester, num_repeticion=repetition).count()
79
 
80
+ expected_ratings_repetition = num_products * num_words
81
 
82
+ return num_ratings_now >= expected_ratings_repetition
83
  else:
84
  return participation.finalizado
85
  except Participacion.DoesNotExist:
tecnicas/static/js/created-scale.js CHANGED
@@ -117,7 +117,7 @@ function addBtnNextWord() {
117
 
118
  const btnNesxtWord = document.createElement("button");
119
  btnNesxtWord.classList.add(...BTN_CLASS_STYLE, "ct-btn-next-word");
120
- btnNesxtWord.textContent = "Siguiente palabra";
121
  btnNesxtWord.addEventListener("click", nextWord);
122
 
123
  const articleContainer = document.createElement("article");
 
117
 
118
  const btnNesxtWord = document.createElement("button");
119
  btnNesxtWord.classList.add(...BTN_CLASS_STYLE, "ct-btn-next-word");
120
+ btnNesxtWord.textContent = "Siguiente producto";
121
  btnNesxtWord.addEventListener("click", nextWord);
122
 
123
  const articleContainer = document.createElement("article");
tecnicas/static/js/start-tester-test.js CHANGED
@@ -2,3 +2,9 @@ function startTest() {
2
  const actionForms = document.querySelector(".ct-action-form");
3
  actionForms.submit();
4
  }
 
 
 
 
 
 
 
2
  const actionForms = document.querySelector(".ct-action-form");
3
  actionForms.submit();
4
  }
5
+
6
+ function closeSession() {
7
+ const actionForms = document.querySelector(".ct-action-form");
8
+ actionForms.querySelector(".action-option").value = "close_session"
9
+ actionForms.submit();
10
+ }
tecnicas/templates/tecnicas/cata-login.html CHANGED
@@ -35,8 +35,7 @@
35
  </label>
36
 
37
  <section class="flex flex-row flex-wrap gap-4 w-f ull justify-center">
38
- <button type="submit"
39
- class="cts-btn-general cts-btn-primary btn-push uppercase lg:w-sm">
40
  Ingresar
41
  </button>
42
  </section>
@@ -50,8 +49,10 @@
50
  {% block extra_js %}
51
  <script>
52
  const error = document.querySelector(".ct-notification-error")
53
- setTimeout(() => {
54
- error.classList.add("hidden")
55
- }, 4000)
 
 
56
  </script>
57
  {% endblock %}
 
35
  </label>
36
 
37
  <section class="flex flex-row flex-wrap gap-4 w-f ull justify-center">
38
+ <button type="submit" class="cts-btn-general cts-btn-primary btn-push uppercase lg:w-sm">
 
39
  Ingresar
40
  </button>
41
  </section>
 
49
  {% block extra_js %}
50
  <script>
51
  const error = document.querySelector(".ct-notification-error")
52
+ if (error) {
53
+ setTimeout(() => {
54
+ error.classList.add("hidden")
55
+ }, 4000)
56
+ }
57
  </script>
58
  {% endblock %}
tecnicas/templates/tecnicas/forms_tester/convencional.html CHANGED
@@ -176,7 +176,7 @@
176
  <section>
177
  <div class="w-full min-w-xs">
178
  <div class="relative mx-6">
179
- <input type="range" min="1" max="{{scale.longitud}}" step="1"
180
  class="w-full range range-md text-blue-400 [--range-bg:orange] [--range-thumb:blue] [--range-fill:0] z-5">
181
  <div
182
  class="absolute top-0 left-0 w-full h-full z-10 flex justify-between pointer-events-none">
 
176
  <section>
177
  <div class="w-full min-w-xs">
178
  <div class="relative mx-6">
179
+ <input type="range" min="1" max="{{scale.longitud}}" step="1" name="rating-word"
180
  class="w-full range range-md text-blue-400 [--range-bg:orange] [--range-thumb:blue] [--range-fill:0] z-5">
181
  <div
182
  class="absolute top-0 left-0 w-full h-full z-10 flex justify-between pointer-events-none">
tecnicas/templates/tecnicas/forms_tester/main_tester.html CHANGED
@@ -31,8 +31,8 @@
31
  {% if message %}
32
  <hr>
33
 
34
- <article class="bg-blue-600 p-4 text-white rounded-xl ct-notification-error">
35
- <p class="block font-sans text-white text-xl antialiased font-bold uppercase tracking-wider text-center">
36
  {{ message }}
37
  </p>
38
  </article>
@@ -99,10 +99,9 @@
99
 
100
  <article class="flex flex-wrap gap-10">
101
  {% if has_ended %}
102
- <button
103
- 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-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" disabled>
104
- Finalizaste la sesión
105
- </button>
106
  {% else %}
107
  <button
108
  class="ct-btn-start-repition flex-1 uppercase text-lg tracking-wider cts-btn-general cts-btn-primary btn-push flex flex-col justify-center items-center gap-2"
@@ -114,7 +113,8 @@
114
  </button>
115
  {% endif %}
116
  <button
117
- class="flex-1 uppercase text-lg tracking-wider cts-btn-general cts-btn-error btn-push flex flex-col justify-center items-center gap-2">
 
118
  Salir se la sesión
119
  <figure class="w-10">
120
  <img src="{% static 'img/exit.svg' %}" alt="bote de basura" class="invert">
@@ -124,7 +124,7 @@
124
 
125
  <form action="" method="post" class="hidden ct-action-form">
126
  {% csrf_token %}
127
- <input type="hidden" name="action" value="start_posting">
128
  </form>
129
  </article>
130
  </article>
 
31
  {% if message %}
32
  <hr>
33
 
34
+ <article class="bg-surface-alter-card p-4 rounded-xl max-w-2xl">
35
+ <p class="block text-xl antialiased font-bold text-center">
36
  {{ message }}
37
  </p>
38
  </article>
 
99
 
100
  <article class="flex flex-wrap gap-10">
101
  {% if has_ended %}
102
+ <div class="text-2xl font-semibold flex-1 cts-btn-secondary p-4 flex justify-center items-center rounded-lg select-none">
103
+ <p class=" text-black">Finalizaste la repetición</p>
104
+ </div>
 
105
  {% else %}
106
  <button
107
  class="ct-btn-start-repition flex-1 uppercase text-lg tracking-wider cts-btn-general cts-btn-primary btn-push flex flex-col justify-center items-center gap-2"
 
113
  </button>
114
  {% endif %}
115
  <button
116
+ class="flex-1 uppercase text-lg tracking-wider cts-btn-general cts-btn-error btn-push flex flex-col justify-center items-center gap-2"
117
+ onclick="closeSession()">
118
  Salir se la sesión
119
  <figure class="w-10">
120
  <img src="{% static 'img/exit.svg' %}" alt="bote de basura" class="invert">
 
124
 
125
  <form action="" method="post" class="hidden ct-action-form">
126
  {% csrf_token %}
127
+ <input type="hidden" class="action-option" name="action" value="start_posting">
128
  </form>
129
  </article>
130
  </article>
tecnicas/views/tester_forms/main_tester_form.py CHANGED
@@ -20,7 +20,11 @@ def mainTesterForm(req: HttpRequest):
20
 
21
  if not isinstance(order, dict):
22
  req.session["id_order"] = order.id
23
- if view_controller.isEndedSession(id_participation=req.session["id_participation"], repetition=session.tecnica.repeticion):
 
 
 
 
24
  context["message"] = "El catador ha terminado de realizar su evaluación, espere instrucciones del presentador"
25
  context["has_ended"] = True
26
 
 
20
 
21
  if not isinstance(order, dict):
22
  req.session["id_order"] = order.id
23
+ is_end = view_controller.isEndedSession(
24
+ id_participation=req.session["id_participation"], repetition=session.tecnica.repeticion)
25
+
26
+ if is_end:
27
+ print("Estoy dentro y termine [0_0]")
28
  context["message"] = "El catador ha terminado de realizar su evaluación, espere instrucciones del presentador"
29
  context["has_ended"] = True
30