Spaces:
Sleeping
Sleeping
Merge pull request #29 from CascoArcilla/HU10
Browse files- tecnicas/controllers/views_controller/create_session/panel_basic_controller.py +50 -8
- tecnicas/controllers/views_controller/create_session/panel_codes_controller.py +24 -22
- tecnicas/controllers/views_controller/create_session/panel_create_controller.py +171 -35
- tecnicas/forms/__init__.py +5 -3
- tecnicas/forms/create_session/sesiob_basic_cata_form.py +27 -0
- tecnicas/forms/{sesion_basic_form.py → create_session/sesion_basic_form.py} +1 -3
- tecnicas/forms/{sesion_tags_form.py → create_session/sesion_tags_form.py} +1 -1
- tecnicas/static/js/panel-basic-cata.js +31 -0
- tecnicas/templates/tecnicas/create_sesion/configuracion-panel-codes.html +7 -3
- tecnicas/templates/tecnicas/create_sesion/panel-basic-cata.html +85 -0
- tecnicas/views/sessions_config/configuration_panel_basic.py +5 -0
- tecnicas/views/sessions_config/configuration_panel_codes.py +11 -4
- tecnicas/views/sessions_config/configuration_panel_words.py +20 -11
- tecnicas/views/sessions_config/create_session.py +6 -3
tecnicas/controllers/views_controller/create_session/panel_basic_controller.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from tecnicas.forms import SesionBasicForm
|
| 2 |
from django.http import HttpRequest
|
| 3 |
from django.shortcuts import redirect, render
|
| 4 |
from django.urls import reverse
|
|
@@ -10,6 +10,14 @@ class PanelBasicController():
|
|
| 10 |
"numero_repeticiones": 1
|
| 11 |
}
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
def __init__(self):
|
| 14 |
pass
|
| 15 |
|
|
@@ -23,7 +31,7 @@ class PanelBasicController():
|
|
| 23 |
}
|
| 24 |
|
| 25 |
response = render(
|
| 26 |
-
request,
|
| 27 |
return response
|
| 28 |
|
| 29 |
@staticmethod
|
|
@@ -44,11 +52,11 @@ class PanelBasicController():
|
|
| 44 |
response = redirect(
|
| 45 |
reverse("cata_system:panel_configuracion_tags"))
|
| 46 |
else:
|
| 47 |
-
response = render(request,
|
| 48 |
"form_sesion": form, "error": "Información no valida"})
|
| 49 |
except KeyError:
|
| 50 |
response = redirect(reverse(
|
| 51 |
-
|
| 52 |
|
| 53 |
return response
|
| 54 |
|
|
@@ -63,7 +71,7 @@ class PanelBasicController():
|
|
| 63 |
}
|
| 64 |
|
| 65 |
response = render(
|
| 66 |
-
request,
|
| 67 |
return response
|
| 68 |
|
| 69 |
@staticmethod
|
|
@@ -88,7 +96,7 @@ class PanelBasicController():
|
|
| 88 |
key, f"Valor inválido para '{key}': se esperaba {expected}, se recibió {actual}")
|
| 89 |
|
| 90 |
if form.errors:
|
| 91 |
-
response = render(request,
|
| 92 |
"form_sesion": form, "error": "No puedes modificar el número de catadores o repeticiones"})
|
| 93 |
else:
|
| 94 |
values["name_tecnica"] = name_tecnica
|
|
@@ -96,10 +104,44 @@ class PanelBasicController():
|
|
| 96 |
response = redirect(
|
| 97 |
reverse("cata_system:panel_configuracion_tags"))
|
| 98 |
else:
|
| 99 |
-
response = render(request,
|
| 100 |
"form_sesion": form, "error": "Información no valida"})
|
| 101 |
except KeyError:
|
| 102 |
response = redirect(reverse(
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
return response
|
|
|
|
| 1 |
+
from tecnicas.forms import SesionBasicForm, SesionBasicCATAForm
|
| 2 |
from django.http import HttpRequest
|
| 3 |
from django.shortcuts import redirect, render
|
| 4 |
from django.urls import reverse
|
|
|
|
| 10 |
"numero_repeticiones": 1
|
| 11 |
}
|
| 12 |
|
| 13 |
+
url_panel_basic = "tecnicas/create_sesion/configuracion-panel-basic.html"
|
| 14 |
+
url_panel_basic_cata = "tecnicas/create_sesion/panel-basic-cata.html"
|
| 15 |
+
|
| 16 |
+
url_next_panel_scales = "cata_system:panel_configuracion_tags"
|
| 17 |
+
url_next_panel_cata = "cata_system:panel_configuracion_codes"
|
| 18 |
+
|
| 19 |
+
url_select_technique = "cata_system:seleccion_tecnica"
|
| 20 |
+
|
| 21 |
def __init__(self):
|
| 22 |
pass
|
| 23 |
|
|
|
|
| 31 |
}
|
| 32 |
|
| 33 |
response = render(
|
| 34 |
+
request, PanelBasicController.url_panel_basic, view_context)
|
| 35 |
return response
|
| 36 |
|
| 37 |
@staticmethod
|
|
|
|
| 52 |
response = redirect(
|
| 53 |
reverse("cata_system:panel_configuracion_tags"))
|
| 54 |
else:
|
| 55 |
+
response = render(request, PanelBasicController.url_panel_basic, {
|
| 56 |
"form_sesion": form, "error": "Información no valida"})
|
| 57 |
except KeyError:
|
| 58 |
response = redirect(reverse(
|
| 59 |
+
PanelBasicController.url_select_technique) + "?error=error en datos de configuracion")
|
| 60 |
|
| 61 |
return response
|
| 62 |
|
|
|
|
| 71 |
}
|
| 72 |
|
| 73 |
response = render(
|
| 74 |
+
request, PanelBasicController.url_panel_basic, view_context)
|
| 75 |
return response
|
| 76 |
|
| 77 |
@staticmethod
|
|
|
|
| 96 |
key, f"Valor inválido para '{key}': se esperaba {expected}, se recibió {actual}")
|
| 97 |
|
| 98 |
if form.errors:
|
| 99 |
+
response = render(request, PanelBasicController.url_panel_basic, {
|
| 100 |
"form_sesion": form, "error": "No puedes modificar el número de catadores o repeticiones"})
|
| 101 |
else:
|
| 102 |
values["name_tecnica"] = name_tecnica
|
|
|
|
| 104 |
response = redirect(
|
| 105 |
reverse("cata_system:panel_configuracion_tags"))
|
| 106 |
else:
|
| 107 |
+
response = render(request, PanelBasicController.url_panel_basic, {
|
| 108 |
"form_sesion": form, "error": "Información no valida"})
|
| 109 |
except KeyError:
|
| 110 |
response = redirect(reverse(
|
| 111 |
+
PanelBasicController.url_select_technique) + "?error=error en datos de configuracion")
|
| 112 |
+
|
| 113 |
+
return response
|
| 114 |
+
|
| 115 |
+
@staticmethod
|
| 116 |
+
def controllGetCATA(request: HttpRequest):
|
| 117 |
+
form_sesion = SesionBasicCATAForm()
|
| 118 |
+
|
| 119 |
+
view_context = {
|
| 120 |
+
"form_sesion": form_sesion,
|
| 121 |
+
"use_technique": "cata"
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
return render(
|
| 125 |
+
request, PanelBasicController.url_panel_basic_cata, view_context)
|
| 126 |
+
|
| 127 |
+
@staticmethod
|
| 128 |
+
def controllPostCATA(request: HttpRequest, name_tecnica: str):
|
| 129 |
+
form = SesionBasicCATAForm(request.POST)
|
| 130 |
+
|
| 131 |
+
if form.is_valid():
|
| 132 |
+
values = {}
|
| 133 |
+
for name, value in form.cleaned_data.items():
|
| 134 |
+
if name == "estilo_palabras":
|
| 135 |
+
values[name] = value.id
|
| 136 |
+
else:
|
| 137 |
+
values[name] = value
|
| 138 |
+
|
| 139 |
+
values["name_tecnica"] = name_tecnica
|
| 140 |
+
request.session['form_basic'] = values
|
| 141 |
+
response = redirect(
|
| 142 |
+
reverse(PanelBasicController.url_next_panel_cata))
|
| 143 |
+
else:
|
| 144 |
+
response = render(request, PanelBasicController.url_panel_basic, {
|
| 145 |
+
"form_sesion": form, "error": "Información no valida"})
|
| 146 |
|
| 147 |
return response
|
tecnicas/controllers/views_controller/create_session/panel_codes_controller.py
CHANGED
|
@@ -7,15 +7,16 @@ import json
|
|
| 7 |
|
| 8 |
|
| 9 |
class PanelCodesController():
|
|
|
|
|
|
|
|
|
|
| 10 |
def __init__(self):
|
| 11 |
pass
|
| 12 |
|
| 13 |
@staticmethod
|
| 14 |
def controllGetEscalas(request: HttpRequest, data):
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
num_tester
|
| 18 |
-
) = PanelCodesController.defineInfoConvencional(data)
|
| 19 |
|
| 20 |
codes_products = generarCodigos(num_products)
|
| 21 |
|
|
@@ -27,14 +28,11 @@ class PanelCodesController():
|
|
| 27 |
"use_technique": "escalas"
|
| 28 |
}
|
| 29 |
|
| 30 |
-
return render(request,
|
| 31 |
|
| 32 |
@staticmethod
|
| 33 |
def controllPostEscalas(request: HttpRequest, data):
|
| 34 |
-
|
| 35 |
-
num_products,
|
| 36 |
-
num_tester
|
| 37 |
-
) = PanelCodesController.defineInfoConvencional(data)
|
| 38 |
|
| 39 |
sorts_code = json.loads(request.POST.get("sort_codes"))
|
| 40 |
codes = []
|
|
@@ -60,11 +58,11 @@ class PanelCodesController():
|
|
| 60 |
|
| 61 |
codes_sort["sort_codes"] = sorts_code
|
| 62 |
request.session["form_codes"] = codes_sort
|
| 63 |
-
return redirect(reverse(
|
| 64 |
else:
|
| 65 |
context_codes_form["error"] = "error en los datos recibidos"
|
| 66 |
|
| 67 |
-
return render(request,
|
| 68 |
|
| 69 |
@staticmethod
|
| 70 |
def controllGetRATA(request: HttpRequest, data):
|
|
@@ -78,10 +76,10 @@ class PanelCodesController():
|
|
| 78 |
"use_technique": "rata"
|
| 79 |
}
|
| 80 |
|
| 81 |
-
return render(request,
|
| 82 |
|
| 83 |
@staticmethod
|
| 84 |
-
def controllPostRATA(request: HttpRequest):
|
| 85 |
codes = []
|
| 86 |
context_codes_form = {}
|
| 87 |
|
|
@@ -93,22 +91,26 @@ class PanelCodesController():
|
|
| 93 |
|
| 94 |
context_codes_form = {
|
| 95 |
"form_codes": form_codes,
|
| 96 |
-
"use_technique": "rata"
|
| 97 |
}
|
| 98 |
|
| 99 |
if form_codes.is_valid():
|
| 100 |
request.session["form_codes"] = codes
|
| 101 |
-
return redirect(reverse(
|
| 102 |
else:
|
| 103 |
context_codes_form["error"] = "error en los datos recibidos"
|
| 104 |
|
| 105 |
-
return render(request,
|
| 106 |
|
| 107 |
@staticmethod
|
| 108 |
-
def
|
| 109 |
num_products = data["numero_productos"]
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
class PanelCodesController():
|
| 10 |
+
url_current_panel = "tecnicas/create_sesion/configuracion-panel-codes.html"
|
| 11 |
+
url_next_panel = "cata_system:panel_configuracion_words"
|
| 12 |
+
|
| 13 |
def __init__(self):
|
| 14 |
pass
|
| 15 |
|
| 16 |
@staticmethod
|
| 17 |
def controllGetEscalas(request: HttpRequest, data):
|
| 18 |
+
num_products = data["numero_productos"]
|
| 19 |
+
num_tester = data["numero_catadores"]
|
|
|
|
|
|
|
| 20 |
|
| 21 |
codes_products = generarCodigos(num_products)
|
| 22 |
|
|
|
|
| 28 |
"use_technique": "escalas"
|
| 29 |
}
|
| 30 |
|
| 31 |
+
return render(request, PanelCodesController.url_current_panel, context_codes_form)
|
| 32 |
|
| 33 |
@staticmethod
|
| 34 |
def controllPostEscalas(request: HttpRequest, data):
|
| 35 |
+
num_tester = data["numero_catadores"]
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
sorts_code = json.loads(request.POST.get("sort_codes"))
|
| 38 |
codes = []
|
|
|
|
| 58 |
|
| 59 |
codes_sort["sort_codes"] = sorts_code
|
| 60 |
request.session["form_codes"] = codes_sort
|
| 61 |
+
return redirect(reverse(PanelCodesController.url_next_panel))
|
| 62 |
else:
|
| 63 |
context_codes_form["error"] = "error en los datos recibidos"
|
| 64 |
|
| 65 |
+
return render(request, PanelCodesController.url_current_panel, context_codes_form)
|
| 66 |
|
| 67 |
@staticmethod
|
| 68 |
def controllGetRATA(request: HttpRequest, data):
|
|
|
|
| 76 |
"use_technique": "rata"
|
| 77 |
}
|
| 78 |
|
| 79 |
+
return render(request, PanelCodesController.url_current_panel, context_codes_form)
|
| 80 |
|
| 81 |
@staticmethod
|
| 82 |
+
def controllPostRATA(request: HttpRequest, is_rata: True):
|
| 83 |
codes = []
|
| 84 |
context_codes_form = {}
|
| 85 |
|
|
|
|
| 91 |
|
| 92 |
context_codes_form = {
|
| 93 |
"form_codes": form_codes,
|
| 94 |
+
"use_technique": "rata" if is_rata else "cata"
|
| 95 |
}
|
| 96 |
|
| 97 |
if form_codes.is_valid():
|
| 98 |
request.session["form_codes"] = codes
|
| 99 |
+
return redirect(reverse(PanelCodesController.url_next_panel))
|
| 100 |
else:
|
| 101 |
context_codes_form["error"] = "error en los datos recibidos"
|
| 102 |
|
| 103 |
+
return render(request, PanelCodesController.url_current_panel, context_codes_form)
|
| 104 |
|
| 105 |
@staticmethod
|
| 106 |
+
def controllGetCATA(request: HttpRequest, data):
|
| 107 |
num_products = data["numero_productos"]
|
| 108 |
+
codes_products = generarCodigos(num_products)
|
| 109 |
+
form_codes = CodesForm(codes=codes_products)
|
| 110 |
+
|
| 111 |
+
context_codes_form = {
|
| 112 |
+
"form_codes": form_codes,
|
| 113 |
+
"use_technique": "cata"
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
return render(request, PanelCodesController.url_current_panel, context_codes_form)
|
tecnicas/controllers/views_controller/create_session/panel_create_controller.py
CHANGED
|
@@ -2,7 +2,7 @@ from django.http import HttpRequest, JsonResponse
|
|
| 2 |
from django.db import transaction
|
| 3 |
from django.shortcuts import render
|
| 4 |
from tecnicas.utils import general_error
|
| 5 |
-
from tecnicas.models import EsVocabulario, Vocabulario
|
| 6 |
from tecnicas.controllers import TecnicaController, EscalaController, ProductosController, OrdenesController, EstiloPalabrasController, PalabrasController, SesionController
|
| 7 |
from tecnicas.utils import deleteDataSession
|
| 8 |
|
|
@@ -190,9 +190,17 @@ class PanelCreateController():
|
|
| 190 |
data_basic = request.session["form_basic"]
|
| 191 |
data_basic["numero_catadores"] = 0
|
| 192 |
data_basic["numero_repeticiones"] = 1
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
if not technique:
|
| 197 |
raise ValueError("Error al guardar la técnica")
|
| 198 |
|
|
@@ -220,15 +228,18 @@ class PanelCreateController():
|
|
| 220 |
# ////////////////////////////////////////////// #
|
| 221 |
codes = request.session["form_codes"]
|
| 222 |
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
technique=technique
|
| 226 |
-
)
|
| 227 |
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
|
| 233 |
# /////////////////////////////////////////////////////// #
|
| 234 |
#
|
|
@@ -236,24 +247,23 @@ class PanelCreateController():
|
|
| 236 |
#
|
| 237 |
# /////////////////////////////////////////////////////// #
|
| 238 |
style_words = technique.id_estilo.nombre_estilo
|
|
|
|
| 239 |
if style_words == "atributos":
|
| 240 |
-
|
| 241 |
-
|
| 242 |
|
| 243 |
-
|
| 244 |
-
if isinstance(words_to_use, dict):
|
| 245 |
-
raise ValueError(words_to_use["error"])
|
| 246 |
|
| 247 |
-
|
| 248 |
-
|
|
|
|
| 249 |
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
|
|
|
|
|
|
| 253 |
|
| 254 |
-
words_using = style_controller.relatedWords()
|
| 255 |
-
if isinstance(words_using, dict):
|
| 256 |
-
raise ValueError(words_using["error"])
|
| 257 |
elif style_words == "vocabulario":
|
| 258 |
name_vocabulary = request.session["form_words"]
|
| 259 |
try:
|
|
@@ -266,6 +276,10 @@ class PanelCreateController():
|
|
| 266 |
id_tecnica=technique,
|
| 267 |
id_vocabulario=vocabulary
|
| 268 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
else:
|
| 270 |
raise ValueError("Estilo de palabas no permitido")
|
| 271 |
|
|
@@ -274,25 +288,20 @@ class PanelCreateController():
|
|
| 274 |
# Fourth step: Create session and relat with the technique #
|
| 275 |
#
|
| 276 |
# //////////////////////////////////////////////////////// #
|
| 277 |
-
|
| 278 |
name_session=data_basic["nombre_sesion"] if data_basic["nombre_sesion"] != "" else None,
|
| 279 |
technique=technique,
|
| 280 |
creator=request.user.user_presentador
|
| 281 |
)
|
| 282 |
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
raise ValueError(setting_session["error"])
|
| 286 |
-
|
| 287 |
-
saved_session = session_controller.saveSession()
|
| 288 |
-
if isinstance(saved_session, dict):
|
| 289 |
-
raise ValueError(saved_session["error"])
|
| 290 |
|
| 291 |
context = {
|
| 292 |
"message": "sesión creada",
|
| 293 |
"data": {
|
| 294 |
-
"codigo_sesion":
|
| 295 |
-
"nombre_sesion":
|
| 296 |
}
|
| 297 |
}
|
| 298 |
|
|
@@ -308,3 +317,130 @@ class PanelCreateController():
|
|
| 308 |
return general_error(f"Error: {e}")
|
| 309 |
else:
|
| 310 |
return general_error("No se ha establecido acción")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from django.db import transaction
|
| 3 |
from django.shortcuts import render
|
| 4 |
from tecnicas.utils import general_error
|
| 5 |
+
from tecnicas.models import EsAtributo, EsVocabulario, Vocabulario, Tecnica, TipoTecnica, EstiloPalabra, Producto, Palabra, SesionSensorial
|
| 6 |
from tecnicas.controllers import TecnicaController, EscalaController, ProductosController, OrdenesController, EstiloPalabrasController, PalabrasController, SesionController
|
| 7 |
from tecnicas.utils import deleteDataSession
|
| 8 |
|
|
|
|
| 190 |
data_basic = request.session["form_basic"]
|
| 191 |
data_basic["numero_catadores"] = 0
|
| 192 |
data_basic["numero_repeticiones"] = 1
|
| 193 |
+
|
| 194 |
+
technique = Tecnica.objects.create(
|
| 195 |
+
tipo_tecnica=TipoTecnica.objects.get(
|
| 196 |
+
nombre_tecnica=data_basic["name_tecnica"]),
|
| 197 |
+
id_estilo=EstiloPalabra.objects.get(
|
| 198 |
+
id=data_basic["estilo_palabras"]),
|
| 199 |
+
repeticiones_max=data_basic["numero_repeticiones"] or 1,
|
| 200 |
+
limite_catadores=data_basic["numero_catadores"],
|
| 201 |
+
instrucciones=data_basic["instrucciones"] or "Espere instrucciones del Presentador",
|
| 202 |
+
)
|
| 203 |
+
|
| 204 |
if not technique:
|
| 205 |
raise ValueError("Error al guardar la técnica")
|
| 206 |
|
|
|
|
| 228 |
# ////////////////////////////////////////////// #
|
| 229 |
codes = request.session["form_codes"]
|
| 230 |
|
| 231 |
+
if not codes:
|
| 232 |
+
raise ValueError("No hay códigos de productos")
|
|
|
|
|
|
|
| 233 |
|
| 234 |
+
products_without_save = []
|
| 235 |
+
for code in codes:
|
| 236 |
+
product = Producto(
|
| 237 |
+
codigoProducto=code,
|
| 238 |
+
id_tecnica=technique
|
| 239 |
+
)
|
| 240 |
+
products_without_save.append(product)
|
| 241 |
+
|
| 242 |
+
Producto.objects.bulk_create(products_without_save)
|
| 243 |
|
| 244 |
# /////////////////////////////////////////////////////// #
|
| 245 |
#
|
|
|
|
| 247 |
#
|
| 248 |
# /////////////////////////////////////////////////////// #
|
| 249 |
style_words = technique.id_estilo.nombre_estilo
|
| 250 |
+
|
| 251 |
if style_words == "atributos":
|
| 252 |
+
raw_ids_words = request.session["form_words"]
|
| 253 |
+
ids_words = [int(id_w) for id_w in raw_ids_words]
|
| 254 |
|
| 255 |
+
words = Palabra.objects.filter(id__in=ids_words)
|
|
|
|
|
|
|
| 256 |
|
| 257 |
+
style_atribute = EsAtributo.objects.create(
|
| 258 |
+
id_tecnica=technique
|
| 259 |
+
)
|
| 260 |
|
| 261 |
+
if not style_atribute:
|
| 262 |
+
raise ValueError(
|
| 263 |
+
"Error al intentar relacionar las palabras con la técnica")
|
| 264 |
+
|
| 265 |
+
style_atribute.palabras.set(words)
|
| 266 |
|
|
|
|
|
|
|
|
|
|
| 267 |
elif style_words == "vocabulario":
|
| 268 |
name_vocabulary = request.session["form_words"]
|
| 269 |
try:
|
|
|
|
| 276 |
id_tecnica=technique,
|
| 277 |
id_vocabulario=vocabulary
|
| 278 |
)
|
| 279 |
+
if not es_vocabulary:
|
| 280 |
+
raise ValueError(
|
| 281 |
+
"Error al intentar relacionar el vocabulario con la técnica")
|
| 282 |
+
|
| 283 |
else:
|
| 284 |
raise ValueError("Estilo de palabas no permitido")
|
| 285 |
|
|
|
|
| 288 |
# Fourth step: Create session and relat with the technique #
|
| 289 |
#
|
| 290 |
# //////////////////////////////////////////////////////// #
|
| 291 |
+
session = SesionSensorial.objects.create(
|
| 292 |
name_session=data_basic["nombre_sesion"] if data_basic["nombre_sesion"] != "" else None,
|
| 293 |
technique=technique,
|
| 294 |
creator=request.user.user_presentador
|
| 295 |
)
|
| 296 |
|
| 297 |
+
if not session:
|
| 298 |
+
raise ValueError("Error al crear sesion sensorial")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 299 |
|
| 300 |
context = {
|
| 301 |
"message": "sesión creada",
|
| 302 |
"data": {
|
| 303 |
+
"codigo_sesion": session.codigo_sesion,
|
| 304 |
+
"nombre_sesion": session.nombre_sesion
|
| 305 |
}
|
| 306 |
}
|
| 307 |
|
|
|
|
| 317 |
return general_error(f"Error: {e}")
|
| 318 |
else:
|
| 319 |
return general_error("No se ha establecido acción")
|
| 320 |
+
|
| 321 |
+
@staticmethod
|
| 322 |
+
def controllPostCATA(request: HttpRequest):
|
| 323 |
+
if request.POST.get('action') == 'create_session':
|
| 324 |
+
if not request.session.get("form_codes") or not request.session.get("form_words"):
|
| 325 |
+
deleteDataSession(request)
|
| 326 |
+
return general_error("No se ha especificado información necesaria para la creación de la sesión, por favor, vuelve a intentarlo")
|
| 327 |
+
try:
|
| 328 |
+
with transaction.atomic():
|
| 329 |
+
# //////////////////////////// #
|
| 330 |
+
#
|
| 331 |
+
# First step: Create technique #
|
| 332 |
+
#
|
| 333 |
+
# //////////////////////////// #
|
| 334 |
+
data_basic = request.session["form_basic"]
|
| 335 |
+
data_basic["numero_catadores"] = 0
|
| 336 |
+
data_basic["numero_repeticiones"] = 1
|
| 337 |
+
|
| 338 |
+
technique = Tecnica.objects.create(
|
| 339 |
+
tipo_tecnica=TipoTecnica.objects.get(
|
| 340 |
+
nombre_tecnica=data_basic["name_tecnica"]),
|
| 341 |
+
id_estilo=EstiloPalabra.objects.get(
|
| 342 |
+
id=data_basic["estilo_palabras"]),
|
| 343 |
+
repeticiones_max=data_basic["numero_repeticiones"] or 1,
|
| 344 |
+
limite_catadores=data_basic["numero_catadores"],
|
| 345 |
+
instrucciones=data_basic["instrucciones"] or "Espere instrucciones del Presentador",
|
| 346 |
+
)
|
| 347 |
+
|
| 348 |
+
if not technique:
|
| 349 |
+
raise ValueError("Error al guardar la técnica")
|
| 350 |
+
|
| 351 |
+
# ////////////////////////////////////////////// #
|
| 352 |
+
#
|
| 353 |
+
# Second step: Create productos with their codes #
|
| 354 |
+
#
|
| 355 |
+
# ////////////////////////////////////////////// #
|
| 356 |
+
codes = request.session["form_codes"]
|
| 357 |
+
|
| 358 |
+
if not codes:
|
| 359 |
+
raise ValueError("No hay códigos de productos")
|
| 360 |
+
|
| 361 |
+
products_without_save = []
|
| 362 |
+
for code in codes:
|
| 363 |
+
product = Producto(
|
| 364 |
+
codigoProducto=code,
|
| 365 |
+
id_tecnica=technique
|
| 366 |
+
)
|
| 367 |
+
products_without_save.append(product)
|
| 368 |
+
|
| 369 |
+
Producto.objects.bulk_create(products_without_save)
|
| 370 |
+
|
| 371 |
+
# /////////////////////////////////////////////////////// #
|
| 372 |
+
#
|
| 373 |
+
# Third step: Create relations technique with Words Style #
|
| 374 |
+
#
|
| 375 |
+
# /////////////////////////////////////////////////////// #
|
| 376 |
+
style_words = technique.id_estilo.nombre_estilo
|
| 377 |
+
|
| 378 |
+
if style_words == "atributos":
|
| 379 |
+
raw_ids_words = request.session["form_words"]
|
| 380 |
+
ids_words = [int(id_w) for id_w in raw_ids_words]
|
| 381 |
+
|
| 382 |
+
words = Palabra.objects.filter(id__in=ids_words)
|
| 383 |
+
|
| 384 |
+
style_atribute = EsAtributo.objects.create(
|
| 385 |
+
id_tecnica=technique
|
| 386 |
+
)
|
| 387 |
+
|
| 388 |
+
if not style_atribute:
|
| 389 |
+
raise ValueError(
|
| 390 |
+
"Error al intentar relacionar las palabras con la técnica")
|
| 391 |
+
|
| 392 |
+
style_atribute.palabras.set(words)
|
| 393 |
+
|
| 394 |
+
elif style_words == "vocabulario":
|
| 395 |
+
name_vocabulary = request.session["form_words"]
|
| 396 |
+
try:
|
| 397 |
+
vocabulary = Vocabulario.objects.get(
|
| 398 |
+
nombre_vocabulario=name_vocabulary)
|
| 399 |
+
except Vocabulario.DoesNotExist:
|
| 400 |
+
raise ValueError("Vocabulario no encontrado")
|
| 401 |
+
|
| 402 |
+
es_vocabulary = EsVocabulario.objects.create(
|
| 403 |
+
id_tecnica=technique,
|
| 404 |
+
id_vocabulario=vocabulary
|
| 405 |
+
)
|
| 406 |
+
if not es_vocabulary:
|
| 407 |
+
raise ValueError(
|
| 408 |
+
"Error al intentar relacionar el vocabulario con la técnica")
|
| 409 |
+
|
| 410 |
+
else:
|
| 411 |
+
raise ValueError("Estilo de palabas no permitido")
|
| 412 |
+
|
| 413 |
+
# //////////////////////////////////////////////////////// #
|
| 414 |
+
#
|
| 415 |
+
# Fourth step: Create session and relat with the technique #
|
| 416 |
+
#
|
| 417 |
+
# //////////////////////////////////////////////////////// #
|
| 418 |
+
session = SesionSensorial.objects.create(
|
| 419 |
+
nombre_sesion=data_basic["nombre_sesion"] if data_basic["nombre_sesion"] != "" else None,
|
| 420 |
+
tecnica=technique,
|
| 421 |
+
creadoPor=request.user.user_presentador
|
| 422 |
+
)
|
| 423 |
+
|
| 424 |
+
if not session:
|
| 425 |
+
raise ValueError("Error al crear sesion sensorial")
|
| 426 |
+
|
| 427 |
+
context = {
|
| 428 |
+
"message": "sesión creada",
|
| 429 |
+
"data": {
|
| 430 |
+
"codigo_sesion": session.codigo_sesion,
|
| 431 |
+
"nombre_sesion": session.nombre_sesion
|
| 432 |
+
}
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
# ////////////////////////////////// #
|
| 436 |
+
#
|
| 437 |
+
# Final step: Delete date en session #
|
| 438 |
+
#
|
| 439 |
+
# ////////////////////////////////// #
|
| 440 |
+
deleteDataSession(request)
|
| 441 |
+
return JsonResponse(context)
|
| 442 |
+
|
| 443 |
+
except ValueError as e:
|
| 444 |
+
return general_error(f"Error: {e}")
|
| 445 |
+
else:
|
| 446 |
+
return general_error("No se ha establecido acción")
|
tecnicas/forms/__init__.py
CHANGED
|
@@ -1,7 +1,9 @@
|
|
| 1 |
-
from .sesion_basic_form import SesionBasicForm
|
| 2 |
-
from .
|
|
|
|
|
|
|
| 3 |
from .etiqueta_form import EtiquetaForm
|
| 4 |
from .codes_form import CodesForm
|
| 5 |
from .catador_form import CatadorForm
|
| 6 |
from .word_form import WordForm
|
| 7 |
-
from .vocabulary_select import VocabularioSelectForm
|
|
|
|
| 1 |
+
from .create_session.sesion_basic_form import SesionBasicForm
|
| 2 |
+
from .create_session.sesiob_basic_cata_form import SesionBasicCATAForm
|
| 3 |
+
from .create_session.sesion_tags_form import SesionTagsForm
|
| 4 |
+
|
| 5 |
from .etiqueta_form import EtiquetaForm
|
| 6 |
from .codes_form import CodesForm
|
| 7 |
from .catador_form import CatadorForm
|
| 8 |
from .word_form import WordForm
|
| 9 |
+
from .vocabulary_select import VocabularioSelectForm
|
tecnicas/forms/create_session/sesiob_basic_cata_form.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django import forms
|
| 2 |
+
from tecnicas.models import EstiloPalabra
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class SesionBasicCATAForm(forms.Form):
|
| 6 |
+
nombre_sesion = forms.CharField(max_length=255, widget=forms.TextInput(attrs={
|
| 7 |
+
"class": "bg-surface-ligt border-b-1 text-center w-full p-1",
|
| 8 |
+
"name": "nombre_sesion",
|
| 9 |
+
"placeholder": "Ej. Mermelada de mango picante"
|
| 10 |
+
}), required=False)
|
| 11 |
+
|
| 12 |
+
numero_productos = forms.IntegerField(widget=forms.NumberInput(attrs={
|
| 13 |
+
"class": "bg-surface-ligt p-1 border-b-1 text-center w-full",
|
| 14 |
+
"placeholder": "Solo números"
|
| 15 |
+
}), required=True)
|
| 16 |
+
|
| 17 |
+
instrucciones = forms.CharField(max_length=255, widget=forms.TextInput(attrs={
|
| 18 |
+
"class": "bg-surface-ligt border-b-1 text-center w-full p-1",
|
| 19 |
+
"placeholder": "Este campo es opcional"
|
| 20 |
+
}), required=False)
|
| 21 |
+
|
| 22 |
+
def __init__(self, *args, **kwargs):
|
| 23 |
+
super().__init__(*args, **kwargs)
|
| 24 |
+
|
| 25 |
+
self.fields['estilo_palabras'] = forms.ModelChoiceField(queryset=EstiloPalabra.objects.all(), widget=forms.RadioSelect(attrs={
|
| 26 |
+
"class": "uppercase text-lg tracking-wider font-medium p-2 px-4 active:px-5 transition-all rounded-xl bg-blue-500 text-white",
|
| 27 |
+
}), required=True, initial=EstiloPalabra.objects.first())
|
tecnicas/forms/{sesion_basic_form.py → create_session/sesion_basic_form.py}
RENAMED
|
@@ -1,7 +1,5 @@
|
|
| 1 |
from django import forms
|
| 2 |
-
from
|
| 3 |
-
from ..models import TipoTecnica
|
| 4 |
-
from ..models import EstiloPalabra
|
| 5 |
|
| 6 |
|
| 7 |
class SesionBasicForm(forms.Form):
|
|
|
|
| 1 |
from django import forms
|
| 2 |
+
from tecnicas.models import TipoEscala, EstiloPalabra
|
|
|
|
|
|
|
| 3 |
|
| 4 |
|
| 5 |
class SesionBasicForm(forms.Form):
|
tecnicas/forms/{sesion_tags_form.py → create_session/sesion_tags_form.py}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
from django import forms
|
| 2 |
-
from
|
| 3 |
|
| 4 |
|
| 5 |
class SesionTagsForm(forms.Form):
|
|
|
|
| 1 |
from django import forms
|
| 2 |
+
from tecnicas.models import Etiqueta
|
| 3 |
|
| 4 |
|
| 5 |
class SesionTagsForm(forms.Form):
|
tecnicas/static/js/panel-basic-cata.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const descriptons = {
|
| 2 |
+
atributos:
|
| 3 |
+
"Con el estilo atributos elijes las palabras para evaluar los productos",
|
| 4 |
+
vocabulario:
|
| 5 |
+
"Los vocabularios son un conjunto de palabras específicas para evaluar aspectos de un producto",
|
| 6 |
+
};
|
| 7 |
+
|
| 8 |
+
const helpStyleWords = document.querySelector(".cts-help-style-words");
|
| 9 |
+
let radiosStyleWords;
|
| 10 |
+
|
| 11 |
+
function initRadiosStyleWords() {
|
| 12 |
+
radiosStyleWords = document.getElementsByName("estilo_palabras");
|
| 13 |
+
|
| 14 |
+
for (let index = 0; index < radiosStyleWords.length; index++) {
|
| 15 |
+
const radio = radiosStyleWords[index];
|
| 16 |
+
|
| 17 |
+
if (radio.checked) {
|
| 18 |
+
const radioOption = radio.parentElement.textContent.trim();
|
| 19 |
+
const textHelp = descriptons[radioOption];
|
| 20 |
+
helpStyleWords.textContent = textHelp;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
radio.parentElement.addEventListener("click", (e) => {
|
| 24 |
+
const radioOption = radio.parentElement.textContent.trim();
|
| 25 |
+
const textHelp = descriptons[radioOption];
|
| 26 |
+
helpStyleWords.textContent = textHelp;
|
| 27 |
+
});
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
initRadiosStyleWords();
|
tecnicas/templates/tecnicas/create_sesion/configuracion-panel-codes.html
CHANGED
|
@@ -7,13 +7,18 @@
|
|
| 7 |
<article class="cts-container-main">
|
| 8 |
<article class="cts-wrap-content text-black">
|
| 9 |
<h1 class="text-center font-bold text-4xl">Panel de configuración</h1>
|
|
|
|
| 10 |
{% if error %}
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
| 12 |
{% endif %}
|
|
|
|
| 13 |
<form method="post" action="" class="ct-codes-form flex flex-col gap-5">
|
| 14 |
{% csrf_token %}
|
| 15 |
<h2 class="text-2xl mb-2 font-bold">Codificar productos</h2>
|
| 16 |
-
|
| 17 |
<article class="w-full flex flex-col justify-center items-center gap-5">
|
| 18 |
<p class="text-center font-bold tracking-wide text-xl bg-surface-card px-3 py-3 pb-4 rounded max-w-4xl">
|
| 19 |
Puede dejar los campos como están para usar los códigos predefinidos.
|
|
@@ -47,7 +52,6 @@
|
|
| 47 |
</article>
|
| 48 |
{% endif %}
|
| 49 |
|
| 50 |
-
<hr>
|
| 51 |
<article class="flex flex-col items-center gap-4">
|
| 52 |
<section class="flex w-full max-sm:flex-col flex-wrap gap-4 max-w-2xl">
|
| 53 |
<button type="submit" class="cts-btn-general cts-btn-primary btn-push flex-1 w-full">
|
|
|
|
| 7 |
<article class="cts-container-main">
|
| 8 |
<article class="cts-wrap-content text-black">
|
| 9 |
<h1 class="text-center font-bold text-4xl">Panel de configuración</h1>
|
| 10 |
+
|
| 11 |
{% if error %}
|
| 12 |
+
{% include "./components/error-message.html" with message=error %}
|
| 13 |
+
{% endif %}
|
| 14 |
+
{% if message %}
|
| 15 |
+
{% include "./components/error-message.html" with message=message %}
|
| 16 |
{% endif %}
|
| 17 |
+
|
| 18 |
<form method="post" action="" class="ct-codes-form flex flex-col gap-5">
|
| 19 |
{% csrf_token %}
|
| 20 |
<h2 class="text-2xl mb-2 font-bold">Codificar productos</h2>
|
| 21 |
+
|
| 22 |
<article class="w-full flex flex-col justify-center items-center gap-5">
|
| 23 |
<p class="text-center font-bold tracking-wide text-xl bg-surface-card px-3 py-3 pb-4 rounded max-w-4xl">
|
| 24 |
Puede dejar los campos como están para usar los códigos predefinidos.
|
|
|
|
| 52 |
</article>
|
| 53 |
{% endif %}
|
| 54 |
|
|
|
|
| 55 |
<article class="flex flex-col items-center gap-4">
|
| 56 |
<section class="flex w-full max-sm:flex-col flex-wrap gap-4 max-w-2xl">
|
| 57 |
<button type="submit" class="cts-btn-general cts-btn-primary btn-push flex-1 w-full">
|
tecnicas/templates/tecnicas/create_sesion/panel-basic-cata.html
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'tecnicas/layouts/base.html' %}
|
| 2 |
+
{% load static %}
|
| 3 |
+
|
| 4 |
+
{% block title %}Panel Configuracion{% endblock %}
|
| 5 |
+
|
| 6 |
+
{% block content %}
|
| 7 |
+
<article class="cts-container-main">
|
| 8 |
+
<article class="cts-wrap-content text-black">
|
| 9 |
+
<h1 class="text-center font-bold text-4xl">Panel de configuración</h1>
|
| 10 |
+
|
| 11 |
+
{% if error %}
|
| 12 |
+
{% include "../components/error-message.html" with message=error %}
|
| 13 |
+
{% endif %}
|
| 14 |
+
{% if message %}
|
| 15 |
+
{% include "../components/error-message.html" with message=message %}
|
| 16 |
+
{% endif %}
|
| 17 |
+
|
| 18 |
+
<form method="post" action="" class="space-y-4">
|
| 19 |
+
{% csrf_token %}
|
| 20 |
+
<article class="space-y-4">
|
| 21 |
+
<h2 class="text-2xl font-bold">Información Basica</h2>
|
| 22 |
+
|
| 23 |
+
<section class="flex justify-center items-center">
|
| 24 |
+
<label for="{{form_sesion.nombre_sesion.id_for_label}}"
|
| 25 |
+
class="text-lg flex flex-col items-center px-2 w-fit font-medium tracking-wide mb-4">
|
| 26 |
+
<p class="tracking-normal text-xl font-bold">Ingrese el nombre de la sesion si lo desea:</p>
|
| 27 |
+
{{ form_sesion.nombre_sesion }}
|
| 28 |
+
</label>
|
| 29 |
+
</section>
|
| 30 |
+
|
| 31 |
+
<section class="flex justify-center items-center">
|
| 32 |
+
<label for="{{ form_sesion.numero_productos.id_for_label }}"
|
| 33 |
+
class="text-lg flex flex-col items-center px-2 font-medium tracking-wide">
|
| 34 |
+
<p class="tracking-normal text-base font-bold">
|
| 35 |
+
Número de Productos:
|
| 36 |
+
</p>
|
| 37 |
+
{{ form_sesion.numero_productos }}
|
| 38 |
+
</label>
|
| 39 |
+
</section>
|
| 40 |
+
|
| 41 |
+
<section class="flex justify-center items-center">
|
| 42 |
+
<label for="{{form_sesion.instrucciones.id_for_label}}"
|
| 43 |
+
class="text-lg flex flex-col items-center px-2 w-fit font-medium tracking-wide mb-4">
|
| 44 |
+
<p class="tracking-normal text-base font-bold">Ingrese las instrucciones para la tecnica:</p>
|
| 45 |
+
{{ form_sesion.instrucciones }}
|
| 46 |
+
</label>
|
| 47 |
+
</section>
|
| 48 |
+
</article>
|
| 49 |
+
|
| 50 |
+
<article class="cs-escalas-radio flex flex-col gap-4">
|
| 51 |
+
<h2 class="text-2xl font-bold">Selecciona estilo para las palabras</h2>
|
| 52 |
+
<section class="flex flex-row gap-4 justify-around flex-wrap">
|
| 53 |
+
{% for estilo in form_sesion.estilo_palabras %}
|
| 54 |
+
<label for="{{estilo.id_for_label}}"
|
| 55 |
+
class="ct-radio-estilo uppercase text-lg tracking-wider font-bold p-2 px-4 rounded-xl cts-btn-secondary btn-push">
|
| 56 |
+
{{ estilo.tag }}
|
| 57 |
+
{{ estilo.choice_label }}
|
| 58 |
+
</label>
|
| 59 |
+
{% endfor %}
|
| 60 |
+
</section>
|
| 61 |
+
<section class="w-full flex justify-center items-center">
|
| 62 |
+
<p
|
| 63 |
+
class="cts-help-style-words max-w-2xl text-lg font-medium tracking-wide bg-surface-card text-center py-1 px-4 rounded-xl">
|
| 64 |
+
</p>
|
| 65 |
+
</section>
|
| 66 |
+
</article>
|
| 67 |
+
|
| 68 |
+
<article class="w-full flex max-sm:flex-col flex-wrap items-center justify-center gap-4">
|
| 69 |
+
<button type="submit" class="cts-btn-general cts-btn-primary btn-push flex-1/4 w-full">
|
| 70 |
+
Continuar
|
| 71 |
+
</button>
|
| 72 |
+
<a href="{% url 'cata_system:seleccion_tecnica' %}" class="flex-1/4 w-full">
|
| 73 |
+
<button type="button" class="cts-btn-general cts-btn-error btn-push w-full">
|
| 74 |
+
Cancelar la creación
|
| 75 |
+
</button>
|
| 76 |
+
</a>
|
| 77 |
+
</article>
|
| 78 |
+
</form>
|
| 79 |
+
</article>
|
| 80 |
+
</article>
|
| 81 |
+
{% endblock %}
|
| 82 |
+
|
| 83 |
+
{% block extra_js %}
|
| 84 |
+
<script src="{% static 'js/panel-basic-cata.js' %}"></script>
|
| 85 |
+
{% endblock %}
|
tecnicas/views/sessions_config/configuration_panel_basic.py
CHANGED
|
@@ -15,6 +15,8 @@ def configurationPanelBasic(req: HttpRequest):
|
|
| 15 |
response = PanelBasicController.controllGetEscalas(request=req)
|
| 16 |
elif name_tecnica == "rata":
|
| 17 |
response = PanelBasicController.controllGetRATA(request=req)
|
|
|
|
|
|
|
| 18 |
else:
|
| 19 |
response = redirect(
|
| 20 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida o sin implementar")
|
|
@@ -29,6 +31,9 @@ def configurationPanelBasic(req: HttpRequest):
|
|
| 29 |
elif name_tecnica == "rata":
|
| 30 |
response = PanelBasicController.controllPostRATA(
|
| 31 |
request=req, name_tecnica=name_tecnica)
|
|
|
|
|
|
|
|
|
|
| 32 |
else:
|
| 33 |
response = redirect(
|
| 34 |
reverse("cata_system:seleccion_tecnica") + "?error=¡Oh, vaya! Cambio de técnica repentino, vuelve a elegir otra vez")
|
|
|
|
| 15 |
response = PanelBasicController.controllGetEscalas(request=req)
|
| 16 |
elif name_tecnica == "rata":
|
| 17 |
response = PanelBasicController.controllGetRATA(request=req)
|
| 18 |
+
elif name_tecnica == "cata":
|
| 19 |
+
response = PanelBasicController.controllGetCATA(request=req)
|
| 20 |
else:
|
| 21 |
response = redirect(
|
| 22 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida o sin implementar")
|
|
|
|
| 31 |
elif name_tecnica == "rata":
|
| 32 |
response = PanelBasicController.controllPostRATA(
|
| 33 |
request=req, name_tecnica=name_tecnica)
|
| 34 |
+
elif name_tecnica == "cata":
|
| 35 |
+
response = PanelBasicController.controllPostCATA(
|
| 36 |
+
request=req, name_tecnica=name_tecnica)
|
| 37 |
else:
|
| 38 |
response = redirect(
|
| 39 |
reverse("cata_system:seleccion_tecnica") + "?error=¡Oh, vaya! Cambio de técnica repentino, vuelve a elegir otra vez")
|
tecnicas/views/sessions_config/configuration_panel_codes.py
CHANGED
|
@@ -12,25 +12,32 @@ def configurationPanelCodes(req: HttpRequest):
|
|
| 12 |
"?error=datos del formulario requerido no encontrados")
|
| 13 |
|
| 14 |
data_basic = req.session["form_basic"]
|
|
|
|
| 15 |
|
| 16 |
if req.method == "GET":
|
| 17 |
-
if
|
| 18 |
response = PanelCodesController.controllGetEscalas(
|
| 19 |
req, data_basic)
|
| 20 |
-
elif
|
| 21 |
response = PanelCodesController.controllGetRATA(
|
| 22 |
req, data_basic)
|
|
|
|
|
|
|
|
|
|
| 23 |
else:
|
| 24 |
response = redirect(
|
| 25 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
| 26 |
|
| 27 |
return response
|
| 28 |
elif req.method == "POST":
|
| 29 |
-
if
|
| 30 |
response = PanelCodesController.controllPostEscalas(
|
| 31 |
req, data_basic)
|
| 32 |
-
elif
|
| 33 |
response = PanelCodesController.controllPostRATA(request=req)
|
|
|
|
|
|
|
|
|
|
| 34 |
else:
|
| 35 |
response = redirect(
|
| 36 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
|
|
|
| 12 |
"?error=datos del formulario requerido no encontrados")
|
| 13 |
|
| 14 |
data_basic = req.session["form_basic"]
|
| 15 |
+
name_technique = data_basic["name_tecnica"]
|
| 16 |
|
| 17 |
if req.method == "GET":
|
| 18 |
+
if name_technique == "escalas":
|
| 19 |
response = PanelCodesController.controllGetEscalas(
|
| 20 |
req, data_basic)
|
| 21 |
+
elif name_technique == "rata":
|
| 22 |
response = PanelCodesController.controllGetRATA(
|
| 23 |
req, data_basic)
|
| 24 |
+
elif name_technique == "cata":
|
| 25 |
+
response = PanelCodesController.controllGetCATA(
|
| 26 |
+
req, data_basic)
|
| 27 |
else:
|
| 28 |
response = redirect(
|
| 29 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
| 30 |
|
| 31 |
return response
|
| 32 |
elif req.method == "POST":
|
| 33 |
+
if name_technique == "escalas":
|
| 34 |
response = PanelCodesController.controllPostEscalas(
|
| 35 |
req, data_basic)
|
| 36 |
+
elif name_technique == "rata":
|
| 37 |
response = PanelCodesController.controllPostRATA(request=req)
|
| 38 |
+
elif name_technique == "cata":
|
| 39 |
+
response = PanelCodesController.controllPostRATA(
|
| 40 |
+
request=req, is_rata=False)
|
| 41 |
else:
|
| 42 |
response = redirect(
|
| 43 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
tecnicas/views/sessions_config/configuration_panel_words.py
CHANGED
|
@@ -13,14 +13,19 @@ def configurationPanelWords(req: HttpRequest):
|
|
| 13 |
"?error=datos requeridos no encontrados")
|
| 14 |
|
| 15 |
basic_data = req.session["form_basic"]
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
|
| 18 |
if req.method == "GET":
|
| 19 |
-
if
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
| 24 |
else:
|
| 25 |
response = redirect(
|
| 26 |
reverse("cata_system:seleccion_tecnica") + "?error=Estilo de palabras no valida")
|
|
@@ -28,12 +33,15 @@ def configurationPanelWords(req: HttpRequest):
|
|
| 28 |
response = redirect(
|
| 29 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
| 30 |
return response
|
|
|
|
| 31 |
elif req.method == "POST":
|
| 32 |
-
if
|
| 33 |
-
if style_words
|
| 34 |
-
response = PanelWordsController.controllPostEscalasAtributes(
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
else:
|
| 38 |
response = redirect(
|
| 39 |
reverse("cata_system:seleccion_tecnica") + "?error=Estilo de palabras no valida")
|
|
@@ -42,5 +50,6 @@ def configurationPanelWords(req: HttpRequest):
|
|
| 42 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
| 43 |
|
| 44 |
return response
|
|
|
|
| 45 |
else:
|
| 46 |
return JsonResponse({"message": "Método no permitido"})
|
|
|
|
| 13 |
"?error=datos requeridos no encontrados")
|
| 14 |
|
| 15 |
basic_data = req.session["form_basic"]
|
| 16 |
+
name_technique = basic_data["name_tecnica"]
|
| 17 |
+
style_words = EstiloPalabra.objects.get(
|
| 18 |
+
id=basic_data["estilo_palabras"]).nombre_estilo
|
| 19 |
|
| 20 |
if req.method == "GET":
|
| 21 |
+
if name_technique == "escalas" or name_technique == "rata" or name_technique == "cata":
|
| 22 |
+
print()
|
| 23 |
+
if style_words == "atributos":
|
| 24 |
+
response = PanelWordsController.controllGetEscalasAtributes(
|
| 25 |
+
req)
|
| 26 |
+
elif style_words == "vocabulario":
|
| 27 |
+
response = PanelWordsController.controllGetEscalasVocabulary(
|
| 28 |
+
req)
|
| 29 |
else:
|
| 30 |
response = redirect(
|
| 31 |
reverse("cata_system:seleccion_tecnica") + "?error=Estilo de palabras no valida")
|
|
|
|
| 33 |
response = redirect(
|
| 34 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
| 35 |
return response
|
| 36 |
+
|
| 37 |
elif req.method == "POST":
|
| 38 |
+
if name_technique == "escalas" or name_technique == "rata" or name_technique == "cata":
|
| 39 |
+
if style_words == "atributos":
|
| 40 |
+
response = PanelWordsController.controllPostEscalasAtributes(
|
| 41 |
+
req)
|
| 42 |
+
elif style_words == "vocabulario":
|
| 43 |
+
response = PanelWordsController.controllPostEscalasVocabulary(
|
| 44 |
+
req)
|
| 45 |
else:
|
| 46 |
response = redirect(
|
| 47 |
reverse("cata_system:seleccion_tecnica") + "?error=Estilo de palabras no valida")
|
|
|
|
| 50 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
| 51 |
|
| 52 |
return response
|
| 53 |
+
|
| 54 |
else:
|
| 55 |
return JsonResponse({"message": "Método no permitido"})
|
tecnicas/views/sessions_config/create_session.py
CHANGED
|
@@ -12,9 +12,10 @@ def createSession(req: HttpRequest):
|
|
| 12 |
"?error=datos requeridos no encontrados")
|
| 13 |
|
| 14 |
basic_data = req.session["form_basic"]
|
|
|
|
| 15 |
|
| 16 |
if req.method == "GET":
|
| 17 |
-
if
|
| 18 |
response = PanelCreateController.controllGetEscalas(req)
|
| 19 |
else:
|
| 20 |
response = redirect(
|
|
@@ -22,10 +23,12 @@ def createSession(req: HttpRequest):
|
|
| 22 |
|
| 23 |
return response
|
| 24 |
if req.method == "POST":
|
| 25 |
-
if
|
| 26 |
response = PanelCreateController.controllPostEscalas(req)
|
| 27 |
-
elif
|
| 28 |
response = PanelCreateController.controllPostRATA(req)
|
|
|
|
|
|
|
| 29 |
else:
|
| 30 |
response = redirect(
|
| 31 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
|
|
|
| 12 |
"?error=datos requeridos no encontrados")
|
| 13 |
|
| 14 |
basic_data = req.session["form_basic"]
|
| 15 |
+
name_technique = basic_data["name_tecnica"]
|
| 16 |
|
| 17 |
if req.method == "GET":
|
| 18 |
+
if name_technique == "escalas" or name_technique == "rata" or name_technique == "cata":
|
| 19 |
response = PanelCreateController.controllGetEscalas(req)
|
| 20 |
else:
|
| 21 |
response = redirect(
|
|
|
|
| 23 |
|
| 24 |
return response
|
| 25 |
if req.method == "POST":
|
| 26 |
+
if name_technique == "escalas":
|
| 27 |
response = PanelCreateController.controllPostEscalas(req)
|
| 28 |
+
elif name_technique == "rata":
|
| 29 |
response = PanelCreateController.controllPostRATA(req)
|
| 30 |
+
elif name_technique == "cata":
|
| 31 |
+
response = PanelCreateController.controllPostCATA(req)
|
| 32 |
else:
|
| 33 |
response = redirect(
|
| 34 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|