Spaces:
Sleeping
Sleeping
Finalizar primera fase PF por Catador
Browse files- tecnicas/controllers/api_controller/rating_pf_list_controller.py +6 -2
- tecnicas/controllers/views_controller/sessions_tester/init_session/init_session_pf_controller.py +25 -28
- tecnicas/controllers/views_controller/sessions_tester/tests_forms/test_pf_controller.py +17 -1
- tecnicas/static/js/pf-make-list.js +16 -9
- tecnicas/templates/tecnicas/forms_tester/init_session_pf.html +9 -2
- tecnicas/templates/tecnicas/forms_tester/test_pf_list_words.html +13 -5
- tecnicas/views/apis/api_list_words_pf.py +1 -1
- tecnicas/views/tester_forms/pf_test.py +10 -2
tecnicas/controllers/api_controller/rating_pf_list_controller.py
CHANGED
|
@@ -9,7 +9,7 @@ class RatingPFListController():
|
|
| 9 |
pass
|
| 10 |
|
| 11 |
@staticmethod
|
| 12 |
-
def
|
| 13 |
dic_words = {}
|
| 14 |
for index, word in enumerate(words, start=1):
|
| 15 |
dic_words[f"palabra_{index}"] = word
|
|
@@ -63,9 +63,13 @@ def addWordsToListWordsTester(list_words: list[str], list_tester: ListaPalabras)
|
|
| 63 |
names_words_exist = set(
|
| 64 |
all_words.values_list('nombre_palabra', flat=True))
|
| 65 |
|
|
|
|
|
|
|
|
|
|
| 66 |
# Determinar faltantes
|
| 67 |
missing_words = [
|
| 68 |
nombre for nombre in clean_words if nombre not in names_words_exist]
|
|
|
|
| 69 |
|
| 70 |
created_words = []
|
| 71 |
|
|
@@ -82,7 +86,7 @@ def addWordsToListWordsTester(list_words: list[str], list_tester: ListaPalabras)
|
|
| 82 |
created_words.append(palabra)
|
| 83 |
|
| 84 |
# Combinar todas (all_words + created_words)
|
| 85 |
-
all_new_words =
|
| 86 |
|
| 87 |
list_tester.palabras.set(all_new_words)
|
| 88 |
|
|
|
|
| 9 |
pass
|
| 10 |
|
| 11 |
@staticmethod
|
| 12 |
+
def saveList(request: HttpRequest, words: list, current_phase: int):
|
| 13 |
dic_words = {}
|
| 14 |
for index, word in enumerate(words, start=1):
|
| 15 |
dic_words[f"palabra_{index}"] = word
|
|
|
|
| 63 |
names_words_exist = set(
|
| 64 |
all_words.values_list('nombre_palabra', flat=True))
|
| 65 |
|
| 66 |
+
# Ejecutar el query para no sumar palabras repetidas
|
| 67 |
+
all_words = list(all_words)
|
| 68 |
+
|
| 69 |
# Determinar faltantes
|
| 70 |
missing_words = [
|
| 71 |
nombre for nombre in clean_words if nombre not in names_words_exist]
|
| 72 |
+
print("No save words", missing_words)
|
| 73 |
|
| 74 |
created_words = []
|
| 75 |
|
|
|
|
| 86 |
created_words.append(palabra)
|
| 87 |
|
| 88 |
# Combinar todas (all_words + created_words)
|
| 89 |
+
all_new_words = all_words + created_words
|
| 90 |
|
| 91 |
list_tester.palabras.set(all_new_words)
|
| 92 |
|
tecnicas/controllers/views_controller/sessions_tester/init_session/init_session_pf_controller.py
CHANGED
|
@@ -18,18 +18,15 @@ class InitSessionPFController(InitSessionController):
|
|
| 18 |
"type_technique": self.session.tecnica.tipo_tecnica.nombre_tecnica
|
| 19 |
}
|
| 20 |
|
| 21 |
-
(is_end, message) = self.isEndedSession()
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
|
| 26 |
if "error" in request.GET:
|
| 27 |
context["error"] = request.GET["error"]
|
| 28 |
|
| 29 |
-
(current_activity, reptition) = self.getCurrentActicity()
|
| 30 |
-
context["activity"] = current_activity
|
| 31 |
-
context["repetition"] = reptition
|
| 32 |
-
|
| 33 |
return render(request, self.current_direction, context)
|
| 34 |
|
| 35 |
def controllPost(self, request: HttpRequest):
|
|
@@ -38,15 +35,16 @@ class InitSessionPFController(InitSessionController):
|
|
| 38 |
"type_technique": self.session.tecnica.tipo_tecnica.nombre_tecnica
|
| 39 |
}
|
| 40 |
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
parameters = {
|
| 43 |
"code_sesion": self.session.codigo_sesion
|
| 44 |
}
|
| 45 |
|
| 46 |
-
(is_end, message) = self.isEndedSession()
|
| 47 |
if is_end:
|
| 48 |
-
|
| 49 |
-
return render(request, self.current_direction, context)
|
| 50 |
|
| 51 |
update_participation = ParticipacionController.enterSession(
|
| 52 |
tester=request.user.user_catador, session=self.session)
|
|
@@ -58,7 +56,7 @@ class InitSessionPFController(InitSessionController):
|
|
| 58 |
|
| 59 |
return redirect(reverse(self.pf_direction, kwargs=parameters))
|
| 60 |
|
| 61 |
-
elif
|
| 62 |
response = ParticipacionController.outSession(
|
| 63 |
tester=request.user.user_catador, session=self.session)
|
| 64 |
if isinstance(response, dict):
|
|
@@ -69,19 +67,29 @@ class InitSessionPFController(InitSessionController):
|
|
| 69 |
context["error"] = "Acción sin especificar"
|
| 70 |
return render(request, self.current_direction, context)
|
| 71 |
|
| 72 |
-
def isEndedSession(self) -> tuple[bool, str]:
|
| 73 |
rep = self.session.tecnica.repeticion
|
| 74 |
|
| 75 |
is_end = False
|
| 76 |
message = ""
|
| 77 |
-
|
|
|
|
|
|
|
| 78 |
is_end = self.endedSessionMakeList()
|
| 79 |
-
message = "Ya has creado la Lista de palabras
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
is_end = self.endedSessionRepetition()
|
| 82 |
message = "Has finalizado con el proceso de calificación" if is_end else "Debe hacer tu proceso de calificación"
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
-
return (is_end, message)
|
| 85 |
|
| 86 |
def endedSessionMakeList(self):
|
| 87 |
try:
|
|
@@ -134,14 +142,3 @@ class InitSessionPFController(InitSessionController):
|
|
| 134 |
except Participacion.DoesNotExist:
|
| 135 |
print("No se ha encontrado la participación")
|
| 136 |
return False
|
| 137 |
-
|
| 138 |
-
def getCurrentActicity(self) -> tuple[str, int]:
|
| 139 |
-
rep = self.session.tecnica.repeticion
|
| 140 |
-
if rep == 1:
|
| 141 |
-
return ("Debes realizar tu lista de palabras inicial", 0)
|
| 142 |
-
elif rep == 2:
|
| 143 |
-
return ("Debes realizar tu lista de palabras final", 0)
|
| 144 |
-
elif rep >= 3:
|
| 145 |
-
return ("Debes realizar el proceso de calificación con tu lista de palabras", rep - 2)
|
| 146 |
-
else:
|
| 147 |
-
return ("Ha ocurrido algún error", 0)
|
|
|
|
| 18 |
"type_technique": self.session.tecnica.tipo_tecnica.nombre_tecnica
|
| 19 |
}
|
| 20 |
|
| 21 |
+
(is_end, message, rep_show) = self.isEndedSession()
|
| 22 |
|
| 23 |
+
context["has_ended"] = is_end
|
| 24 |
+
context["activity"] = message
|
| 25 |
+
context["repetition"] = rep_show
|
| 26 |
|
| 27 |
if "error" in request.GET:
|
| 28 |
context["error"] = request.GET["error"]
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
return render(request, self.current_direction, context)
|
| 31 |
|
| 32 |
def controllPost(self, request: HttpRequest):
|
|
|
|
| 35 |
"type_technique": self.session.tecnica.tipo_tecnica.nombre_tecnica
|
| 36 |
}
|
| 37 |
|
| 38 |
+
action = request.POST["action"]
|
| 39 |
+
|
| 40 |
+
if action == "start_posting":
|
| 41 |
parameters = {
|
| 42 |
"code_sesion": self.session.codigo_sesion
|
| 43 |
}
|
| 44 |
|
| 45 |
+
(is_end, message, rep_show) = self.isEndedSession()
|
| 46 |
if is_end:
|
| 47 |
+
return self.controllGet(request)
|
|
|
|
| 48 |
|
| 49 |
update_participation = ParticipacionController.enterSession(
|
| 50 |
tester=request.user.user_catador, session=self.session)
|
|
|
|
| 56 |
|
| 57 |
return redirect(reverse(self.pf_direction, kwargs=parameters))
|
| 58 |
|
| 59 |
+
elif action == "exit_session":
|
| 60 |
response = ParticipacionController.outSession(
|
| 61 |
tester=request.user.user_catador, session=self.session)
|
| 62 |
if isinstance(response, dict):
|
|
|
|
| 67 |
context["error"] = "Acción sin especificar"
|
| 68 |
return render(request, self.current_direction, context)
|
| 69 |
|
| 70 |
+
def isEndedSession(self) -> tuple[bool, str, int]:
|
| 71 |
rep = self.session.tecnica.repeticion
|
| 72 |
|
| 73 |
is_end = False
|
| 74 |
message = ""
|
| 75 |
+
repetitiom_show = 0
|
| 76 |
+
|
| 77 |
+
if rep == 1:
|
| 78 |
is_end = self.endedSessionMakeList()
|
| 79 |
+
message = "Ya has creado la Lista de palabras inicial" if is_end else "Debes crear tu lista de palabras inicial"
|
| 80 |
+
repetitiom_show = 0
|
| 81 |
+
elif rep == 2:
|
| 82 |
+
is_end = self.endedSessionMakeList()
|
| 83 |
+
message = "Ya has creado la Lista de palabras final" if is_end else "Debes crear tu lista de palabras final"
|
| 84 |
+
repetitiom_show = 0
|
| 85 |
+
elif rep >= 3:
|
| 86 |
is_end = self.endedSessionRepetition()
|
| 87 |
message = "Has finalizado con el proceso de calificación" if is_end else "Debe hacer tu proceso de calificación"
|
| 88 |
+
repetitiom_show = rep - 2
|
| 89 |
+
else:
|
| 90 |
+
message = "Parece que la repetición es cero, no es posible hacer algo ahora mismo"
|
| 91 |
|
| 92 |
+
return (is_end, message, repetitiom_show)
|
| 93 |
|
| 94 |
def endedSessionMakeList(self):
|
| 95 |
try:
|
|
|
|
| 142 |
except Participacion.DoesNotExist:
|
| 143 |
print("No se ha encontrado la participación")
|
| 144 |
return False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tecnicas/controllers/views_controller/sessions_tester/tests_forms/test_pf_controller.py
CHANGED
|
@@ -11,11 +11,14 @@ class TestPFController(GenetalTestController):
|
|
| 11 |
def __init__(self, sensorial_session, user_tester):
|
| 12 |
super().__init__(sensorial_session, user_tester)
|
| 13 |
|
| 14 |
-
def controllGet(self, request: HttpRequest):
|
| 15 |
self.participation = Participacion.objects.get(
|
| 16 |
tecnica=self.session.tecnica, catador=request.user.user_catador)
|
| 17 |
self.context["session"] = self.session
|
| 18 |
|
|
|
|
|
|
|
|
|
|
| 19 |
rep = self.session.tecnica.repeticion
|
| 20 |
|
| 21 |
if rep == 1:
|
|
@@ -30,6 +33,19 @@ class TestPFController(GenetalTestController):
|
|
| 30 |
|
| 31 |
return response
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
def getFirstPhase(self, request: HttpRequest):
|
| 34 |
self.participation.refresh_from_db()
|
| 35 |
|
|
|
|
| 11 |
def __init__(self, sensorial_session, user_tester):
|
| 12 |
super().__init__(sensorial_session, user_tester)
|
| 13 |
|
| 14 |
+
def controllGet(self, request: HttpRequest, error=""):
|
| 15 |
self.participation = Participacion.objects.get(
|
| 16 |
tecnica=self.session.tecnica, catador=request.user.user_catador)
|
| 17 |
self.context["session"] = self.session
|
| 18 |
|
| 19 |
+
if error:
|
| 20 |
+
self.context["error"] = error
|
| 21 |
+
|
| 22 |
rep = self.session.tecnica.repeticion
|
| 23 |
|
| 24 |
if rep == 1:
|
|
|
|
| 33 |
|
| 34 |
return response
|
| 35 |
|
| 36 |
+
def controllPost(self, request: HttpRequest):
|
| 37 |
+
action = request.POST["action"]
|
| 38 |
+
|
| 39 |
+
if action == "finish_session":
|
| 40 |
+
self.participation = Participacion.objects.get(
|
| 41 |
+
tecnica=self.session.tecnica, catador=request.user.user_catador)
|
| 42 |
+
ParticipacionController.finishSession(self.participation)
|
| 43 |
+
params = {"code_sesion": self.session.codigo_sesion}
|
| 44 |
+
return redirect(reverse(self.previus_directory, kwargs=params))
|
| 45 |
+
|
| 46 |
+
else:
|
| 47 |
+
return self.controllGet(request, error="Acción no permitida")
|
| 48 |
+
|
| 49 |
def getFirstPhase(self, request: HttpRequest):
|
| 50 |
self.participation.refresh_from_db()
|
| 51 |
|
tecnicas/static/js/pf-make-list.js
CHANGED
|
@@ -147,7 +147,7 @@ function spanNotifaction(messageError, isError = true) {
|
|
| 147 |
async function sendWordsToSave() {
|
| 148 |
if (!WORDS.length) {
|
| 149 |
spanNotifaction("Debe existir al menos una palabra en la lista");
|
| 150 |
-
return;
|
| 151 |
}
|
| 152 |
|
| 153 |
const currentPhase = parseInt(
|
|
@@ -176,7 +176,7 @@ async function sendWordsToSave() {
|
|
| 176 |
|
| 177 |
if (!response.ok) {
|
| 178 |
spanNotifaction("Fallo con la respuesta recibida");
|
| 179 |
-
return;
|
| 180 |
}
|
| 181 |
|
| 182 |
const result = await response.json();
|
|
@@ -185,7 +185,7 @@ async function sendWordsToSave() {
|
|
| 185 |
|
| 186 |
if (messError) {
|
| 187 |
spanNotifaction(messError);
|
| 188 |
-
return;
|
| 189 |
}
|
| 190 |
|
| 191 |
spanNotifaction(result.message, false);
|
|
@@ -193,18 +193,25 @@ async function sendWordsToSave() {
|
|
| 193 |
WORDS.length = 0;
|
| 194 |
addedWords.forEach((word) => WORDS.push(word));
|
| 195 |
renderWords();
|
|
|
|
| 196 |
} catch (err) {
|
| 197 |
console.error(err);
|
| 198 |
spanNotifaction("Error en la respuesta del servidor");
|
|
|
|
| 199 |
}
|
| 200 |
}
|
| 201 |
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
|
| 209 |
window.addEventListener("DOMContentLoaded", () => {
|
| 210 |
initWordsFromBox();
|
|
|
|
| 147 |
async function sendWordsToSave() {
|
| 148 |
if (!WORDS.length) {
|
| 149 |
spanNotifaction("Debe existir al menos una palabra en la lista");
|
| 150 |
+
return false;
|
| 151 |
}
|
| 152 |
|
| 153 |
const currentPhase = parseInt(
|
|
|
|
| 176 |
|
| 177 |
if (!response.ok) {
|
| 178 |
spanNotifaction("Fallo con la respuesta recibida");
|
| 179 |
+
return false;
|
| 180 |
}
|
| 181 |
|
| 182 |
const result = await response.json();
|
|
|
|
| 185 |
|
| 186 |
if (messError) {
|
| 187 |
spanNotifaction(messError);
|
| 188 |
+
return false;
|
| 189 |
}
|
| 190 |
|
| 191 |
spanNotifaction(result.message, false);
|
|
|
|
| 193 |
WORDS.length = 0;
|
| 194 |
addedWords.forEach((word) => WORDS.push(word));
|
| 195 |
renderWords();
|
| 196 |
+
return true;
|
| 197 |
} catch (err) {
|
| 198 |
console.error(err);
|
| 199 |
spanNotifaction("Error en la respuesta del servidor");
|
| 200 |
+
return false;
|
| 201 |
}
|
| 202 |
}
|
| 203 |
|
| 204 |
+
async function setUpFormAction() {
|
| 205 |
+
const saveWords = await sendWordsToSave();
|
| 206 |
+
if (!saveWords) {
|
| 207 |
+
return false;
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
const input = FORM_ACTION.querySelector(".action-input");
|
| 211 |
+
FORM_ACTION.action = "";
|
| 212 |
+
input.value = "finish_session";
|
| 213 |
+
FORM_ACTION.submit();
|
| 214 |
+
}
|
| 215 |
|
| 216 |
window.addEventListener("DOMContentLoaded", () => {
|
| 217 |
initWordsFromBox();
|
tecnicas/templates/tecnicas/forms_tester/init_session_pf.html
CHANGED
|
@@ -55,7 +55,7 @@
|
|
| 55 |
|
| 56 |
<section>
|
| 57 |
<p class="text-xl font-medium">
|
| 58 |
-
{{ activity }}
|
| 59 |
</p>
|
| 60 |
</section>
|
| 61 |
|
|
@@ -78,10 +78,17 @@
|
|
| 78 |
|
| 79 |
<article class="flex flex-wrap gap-10">
|
| 80 |
{% if has_ended %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
<div
|
| 82 |
class="text-2xl font-semibold flex-1 cts-btn-secondary p-4 flex justify-center items-center rounded-lg select-none">
|
| 83 |
-
<p class=" text-black">Finalizaste la actividad
|
| 84 |
</div>
|
|
|
|
| 85 |
{% else %}
|
| 86 |
<button
|
| 87 |
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"
|
|
|
|
| 55 |
|
| 56 |
<section>
|
| 57 |
<p class="text-xl font-medium">
|
| 58 |
+
<b>Actividad:</b> {{ activity }}
|
| 59 |
</p>
|
| 60 |
</section>
|
| 61 |
|
|
|
|
| 78 |
|
| 79 |
<article class="flex flex-wrap gap-10">
|
| 80 |
{% if has_ended %}
|
| 81 |
+
{% if repetition >= 1 %}
|
| 82 |
+
<div
|
| 83 |
+
class="text-2xl font-semibold flex-1 cts-btn-secondary p-4 flex justify-center items-center rounded-lg select-none">
|
| 84 |
+
<p class=" text-black">Finalizaste la repetición</p>
|
| 85 |
+
</div>
|
| 86 |
+
{% else %}
|
| 87 |
<div
|
| 88 |
class="text-2xl font-semibold flex-1 cts-btn-secondary p-4 flex justify-center items-center rounded-lg select-none">
|
| 89 |
+
<p class=" text-black">Finalizaste la actividad</p>
|
| 90 |
</div>
|
| 91 |
+
{% endif %}
|
| 92 |
{% else %}
|
| 93 |
<button
|
| 94 |
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"
|
tecnicas/templates/tecnicas/forms_tester/test_pf_list_words.html
CHANGED
|
@@ -120,7 +120,8 @@
|
|
| 120 |
Guardar y comprobar palabras actuales
|
| 121 |
</button>
|
| 122 |
|
| 123 |
-
<button type="button" class="cts-btn-general-compress cts-btn-secondary btn-push py-2 px-4 flex-1"
|
|
|
|
| 124 |
Finalizar la sesión
|
| 125 |
</button>
|
| 126 |
</article>
|
|
@@ -131,11 +132,18 @@
|
|
| 131 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
| 132 |
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
| 133 |
</svg>
|
| 134 |
-
<
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
</div>
|
|
|
|
| 139 |
</article>
|
| 140 |
</article>
|
| 141 |
{% endblock %}
|
|
|
|
| 120 |
Guardar y comprobar palabras actuales
|
| 121 |
</button>
|
| 122 |
|
| 123 |
+
<button type="button" class="cts-btn-general-compress cts-btn-secondary btn-push py-2 px-4 flex-1"
|
| 124 |
+
onclick="setUpFormAction()">
|
| 125 |
Finalizar la sesión
|
| 126 |
</button>
|
| 127 |
</article>
|
|
|
|
| 132 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
| 133 |
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
| 134 |
</svg>
|
| 135 |
+
<div class="flex-col">
|
| 136 |
+
<span class="text-lg block">
|
| 137 |
+
Si usas el botón <b>“Salir de la sesión”</b> asegúrese de guardar las palabras de lo contrario las
|
| 138 |
+
palabras no se guardaran pero podrás ingresar otra vez
|
| 139 |
+
</span>
|
| 140 |
+
<span class="text-lg block">
|
| 141 |
+
Con el botón <b>“Finalizar la sesión”</b>, se guardan las palabras, sales de la sesión y no podrás
|
| 142 |
+
ingresar otra vez
|
| 143 |
+
</span>
|
| 144 |
+
</div>
|
| 145 |
</div>
|
| 146 |
+
|
| 147 |
</article>
|
| 148 |
</article>
|
| 149 |
{% endblock %}
|
tecnicas/views/apis/api_list_words_pf.py
CHANGED
|
@@ -11,7 +11,7 @@ def apiListWordsPF(req: HttpRequest):
|
|
| 11 |
raw_words = data.get("words", [])
|
| 12 |
phase = data.get("phase", [])
|
| 13 |
|
| 14 |
-
response = RatingPFListController.
|
| 15 |
request=req, current_phase=phase, words=raw_words)
|
| 16 |
return response
|
| 17 |
except Exception as e:
|
|
|
|
| 11 |
raw_words = data.get("words", [])
|
| 12 |
phase = data.get("phase", [])
|
| 13 |
|
| 14 |
+
response = RatingPFListController.saveList(
|
| 15 |
request=req, current_phase=phase, words=raw_words)
|
| 16 |
return response
|
| 17 |
except Exception as e:
|
tecnicas/views/tester_forms/pf_test.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
-
from django.http import HttpRequest
|
|
|
|
|
|
|
| 2 |
from tecnicas.models import SesionSensorial
|
| 3 |
-
from tecnicas.controllers import TestPFController
|
| 4 |
|
| 5 |
|
| 6 |
def pfTest(req: HttpRequest, code_sesion: str):
|
|
@@ -9,3 +11,9 @@ def pfTest(req: HttpRequest, code_sesion: str):
|
|
| 9 |
controll_view = TestPFController(
|
| 10 |
sensorial_session=session, user_tester=req.user.user_catador)
|
| 11 |
return controll_view.controllGet(request=req)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.http import HttpRequest, JsonResponse
|
| 2 |
+
from django.shortcuts import redirect
|
| 3 |
+
from django.urls import reverse
|
| 4 |
from tecnicas.models import SesionSensorial
|
| 5 |
+
from tecnicas.controllers import TestPFController, ParticipacionController
|
| 6 |
|
| 7 |
|
| 8 |
def pfTest(req: HttpRequest, code_sesion: str):
|
|
|
|
| 11 |
controll_view = TestPFController(
|
| 12 |
sensorial_session=session, user_tester=req.user.user_catador)
|
| 13 |
return controll_view.controllGet(request=req)
|
| 14 |
+
|
| 15 |
+
if req.method == "POST":
|
| 16 |
+
session = SesionSensorial.objects.get(codigo_sesion=code_sesion)
|
| 17 |
+
controll_view = TestPFController(
|
| 18 |
+
sensorial_session=session, user_tester=req.user.user_catador)
|
| 19 |
+
return controll_view.controllPost(request=req)
|