Spaces:
Sleeping
Sleeping
Tratar errores al crear sesion del cliente, inicio de orquesta para crear sesion con escalas
Browse files- tecnicas/controllers/tecnica_controller.py +15 -3
- tecnicas/models/tecnica.py +16 -3
- tecnicas/static/js/create-session.js +124 -0
- tecnicas/templates/tecnicas/create_sesion/creando_sesion.html +31 -0
- tecnicas/urls.py +1 -0
- tecnicas/views/__init__.py +2 -1
- tecnicas/views/configuration_panel_basic.py +6 -3
- tecnicas/views/configuration_panel_words.py +6 -4
- tecnicas/views/create_session.py +37 -0
tecnicas/controllers/tecnica_controller.py
CHANGED
|
@@ -1,16 +1,28 @@
|
|
| 1 |
-
from ..models import TipoTecnica, CategoriaTecnica, Tecnica
|
| 2 |
|
| 3 |
|
| 4 |
class TecnicaController():
|
| 5 |
def setTechnique(self, **kwargs):
|
| 6 |
-
self.technique = Tecnica
|
| 7 |
tipo_tecnica=kwargs["tipo_tecnica"],
|
|
|
|
| 8 |
repeticiones_max=kwargs["numero_repeticiones"] or 0,
|
| 9 |
limite_catadores=kwargs["numero_catadores"],
|
| 10 |
instrucciones=kwargs["instrucciones"],
|
| 11 |
-
id_estilo=kwargs["estilo_palabras"],
|
| 12 |
)
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
@staticmethod
|
| 15 |
def getTypesTechnique():
|
| 16 |
showTecnicas = {}
|
|
|
|
| 1 |
+
from ..models import TipoTecnica, CategoriaTecnica, Tecnica, EstiloPalabra
|
| 2 |
|
| 3 |
|
| 4 |
class TecnicaController():
|
| 5 |
def setTechnique(self, **kwargs):
|
| 6 |
+
self.technique = Tecnica(
|
| 7 |
tipo_tecnica=kwargs["tipo_tecnica"],
|
| 8 |
+
id_estilo=kwargs["estilo_palabras"],
|
| 9 |
repeticiones_max=kwargs["numero_repeticiones"] or 0,
|
| 10 |
limite_catadores=kwargs["numero_catadores"],
|
| 11 |
instrucciones=kwargs["instrucciones"],
|
|
|
|
| 12 |
)
|
| 13 |
|
| 14 |
+
def setTechniqueFromBasicData(self, basic):
|
| 15 |
+
self.technique = Tecnica(
|
| 16 |
+
tipo_tecnica=TipoTecnica.objects.get(id=basic["id_tecnica"]),
|
| 17 |
+
id_estilo=EstiloPalabra.objects.get(id=basic["estilo_palabras"]),
|
| 18 |
+
repeticiones_max=basic["numero_repeticiones"] or 0,
|
| 19 |
+
limite_catadores=basic["numero_catadores"],
|
| 20 |
+
instrucciones=basic["instrucciones"] or "Espere instrucciones del Presentador",
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
def getDataTechnique(self):
|
| 24 |
+
return self.technique.toDict()
|
| 25 |
+
|
| 26 |
@staticmethod
|
| 27 |
def getTypesTechnique():
|
| 28 |
showTecnicas = {}
|
tecnicas/models/tecnica.py
CHANGED
|
@@ -3,13 +3,26 @@ from django.db import models
|
|
| 3 |
from .estilo_palabra import EstiloPalabra
|
| 4 |
from .tipo_tecnica import TipoTecnica
|
| 5 |
|
|
|
|
| 6 |
class Tecnica(models.Model):
|
| 7 |
-
tipo_tecnica = models.ForeignKey(
|
|
|
|
| 8 |
repeticiones_max = models.IntegerField(default=0)
|
| 9 |
repecion = models.IntegerField(default=0)
|
| 10 |
limite_catadores = models.IntegerField()
|
| 11 |
instrucciones = models.CharField(max_length=255)
|
| 12 |
-
id_estilo = models.ForeignKey(
|
|
|
|
| 13 |
|
| 14 |
def __str__(self):
|
| 15 |
-
return self.tipo_tecnica
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
from .estilo_palabra import EstiloPalabra
|
| 4 |
from .tipo_tecnica import TipoTecnica
|
| 5 |
|
| 6 |
+
|
| 7 |
class Tecnica(models.Model):
|
| 8 |
+
tipo_tecnica = models.ForeignKey(
|
| 9 |
+
TipoTecnica, on_delete=models.CASCADE, related_name="tecnica_tipo_tecnica")
|
| 10 |
repeticiones_max = models.IntegerField(default=0)
|
| 11 |
repecion = models.IntegerField(default=0)
|
| 12 |
limite_catadores = models.IntegerField()
|
| 13 |
instrucciones = models.CharField(max_length=255)
|
| 14 |
+
id_estilo = models.ForeignKey(
|
| 15 |
+
EstiloPalabra, on_delete=models.CASCADE, related_name="estilo_tecnica")
|
| 16 |
|
| 17 |
def __str__(self):
|
| 18 |
+
return self.tipo_tecnica
|
| 19 |
+
|
| 20 |
+
def toDict(self):
|
| 21 |
+
return {
|
| 22 |
+
"tipo_tecnica": self.tipo_tecnica,
|
| 23 |
+
"repeticiones_max": self.repeticiones_max,
|
| 24 |
+
"repecion": self.repecion,
|
| 25 |
+
"limite_catadores": self.limite_catadores,
|
| 26 |
+
"instrucciones": self.instrucciones,
|
| 27 |
+
"id_estilo": self.id_estilo,
|
| 28 |
+
}
|
tecnicas/static/js/create-session.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const formSubmit = document.querySelector(".ct-cretae-session-form");
|
| 2 |
+
|
| 3 |
+
document.addEventListener("DOMContentLoaded", () => {
|
| 4 |
+
setTimeout(() => {
|
| 5 |
+
cretaeSession();
|
| 6 |
+
}, 1000);
|
| 7 |
+
});
|
| 8 |
+
|
| 9 |
+
async function cretaeSession() {
|
| 10 |
+
const dataForm = new FormData(formSubmit);
|
| 11 |
+
const url = `creando-sesion`;
|
| 12 |
+
|
| 13 |
+
try {
|
| 14 |
+
const respone = await fetch(url, {
|
| 15 |
+
method: "POST",
|
| 16 |
+
headers: {
|
| 17 |
+
"X-CSRFToken": dataForm.get("csrfmiddlewaretoken"),
|
| 18 |
+
},
|
| 19 |
+
body: dataForm,
|
| 20 |
+
});
|
| 21 |
+
|
| 22 |
+
const jsonResponse = await respone.json();
|
| 23 |
+
|
| 24 |
+
if (jsonResponse.error) {
|
| 25 |
+
renderElementsResponse({ error: jsonResponse.error });
|
| 26 |
+
return;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
const data = jsonResponse["data"];
|
| 30 |
+
renderElementsResponse({ sessionId: data["session_id"] });
|
| 31 |
+
} catch (error) {
|
| 32 |
+
renderElementsResponse({ error: jsonResponse.error });
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
function renderElementsResponse({ sessionId = "No id", error = false }) {
|
| 37 |
+
const container = document.querySelector(".ct-message-create");
|
| 38 |
+
const loadElement = document.querySelector(".ct-load-create");
|
| 39 |
+
|
| 40 |
+
const p = document.createElement("p");
|
| 41 |
+
p.classList.add("text-2xl", "text-white", "text-center", "font-bold");
|
| 42 |
+
const idSession = document.createElement("p");
|
| 43 |
+
idSession.classList.add("text-lg", "text-white", "text-center", "font-bold");
|
| 44 |
+
const pHelp = document.createElement("p");
|
| 45 |
+
|
| 46 |
+
// ******************************** //
|
| 47 |
+
// Mostrar el error que ha ocurrido //
|
| 48 |
+
// ******************************** //
|
| 49 |
+
if (error) {
|
| 50 |
+
p.textContent = "No se ha podido completar la creacion de la sesion";
|
| 51 |
+
idSession.textContent = `Error: ${error}`;
|
| 52 |
+
} else {
|
| 53 |
+
p.textContent = "La session se ha creado";
|
| 54 |
+
|
| 55 |
+
idSession.innerHTML = `El ID de la seesion es:<br><strong class="border-b border-white">${sessionId}</strong>`;
|
| 56 |
+
|
| 57 |
+
pHelp.classList.add("text-lg", "text-white", "text-center");
|
| 58 |
+
pHelp.textContent =
|
| 59 |
+
"Puedes pasar este ID a los catadores para que ingresen a la sesion";
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
const divBtns = document.createElement("div");
|
| 63 |
+
divBtns.classList.add(
|
| 64 |
+
"flex",
|
| 65 |
+
"flex-wrap",
|
| 66 |
+
"justify-center",
|
| 67 |
+
"items-center",
|
| 68 |
+
"gap-5"
|
| 69 |
+
);
|
| 70 |
+
|
| 71 |
+
const stylesBtns = [
|
| 72 |
+
"uppercase",
|
| 73 |
+
"text-lg",
|
| 74 |
+
"tracking-wider",
|
| 75 |
+
"font-medium",
|
| 76 |
+
"p-2",
|
| 77 |
+
"px-4",
|
| 78 |
+
"border-b-2",
|
| 79 |
+
"active:border-b-0",
|
| 80 |
+
"active:border-t-2",
|
| 81 |
+
"transition-all",
|
| 82 |
+
"rounded-xl",
|
| 83 |
+
"w-fit",
|
| 84 |
+
];
|
| 85 |
+
|
| 86 |
+
const aIndex = document.createElement("a");
|
| 87 |
+
aIndex.href = "{% url 'cata_system:index' %}";
|
| 88 |
+
aIndex.textContent = "Volver al inicio";
|
| 89 |
+
|
| 90 |
+
aIndex.classList.add(
|
| 91 |
+
...stylesBtns,
|
| 92 |
+
"active:border-blue-500",
|
| 93 |
+
"border-blue-800",
|
| 94 |
+
"bg-blue-500",
|
| 95 |
+
"text-white"
|
| 96 |
+
);
|
| 97 |
+
|
| 98 |
+
const aMonitor = document.createElement("a");
|
| 99 |
+
aMonitor.href = "{% url 'cata_system:index' %}";
|
| 100 |
+
aMonitor.textContent = "Monitorear la sesion";
|
| 101 |
+
|
| 102 |
+
aMonitor.classList.add(
|
| 103 |
+
...stylesBtns,
|
| 104 |
+
"active:border-yellow-500",
|
| 105 |
+
"border-yellow-800",
|
| 106 |
+
"bg-yellow-500",
|
| 107 |
+
"text-black"
|
| 108 |
+
);
|
| 109 |
+
|
| 110 |
+
divBtns.appendChild(aIndex);
|
| 111 |
+
if (!error) {
|
| 112 |
+
divBtns.appendChild(aMonitor);
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
loadElement.classList.add("hidden");
|
| 116 |
+
container.classList.remove("hidden");
|
| 117 |
+
|
| 118 |
+
container.innerHTML = "";
|
| 119 |
+
|
| 120 |
+
container.appendChild(p);
|
| 121 |
+
container.appendChild(idSession);
|
| 122 |
+
container.appendChild(pHelp);
|
| 123 |
+
container.appendChild(divBtns);
|
| 124 |
+
}
|
tecnicas/templates/tecnicas/create_sesion/creando_sesion.html
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'tecnicas/layouts/base.html' %}
|
| 2 |
+
{% load static %}
|
| 3 |
+
|
| 4 |
+
{% block title %}Creando sesion{% endblock %}
|
| 5 |
+
|
| 6 |
+
{% block content %}
|
| 7 |
+
<article class="w-full flex flex-col justify-center items-center bg-gray-600 my-10">
|
| 8 |
+
<article class="flex flex-col gap-4 bg-gray-400 md:p-10 p-5 rounded-2xl lg:w-4xl w-full">
|
| 9 |
+
<h1 class="text-center font-bold text-4xl">Creando Sesion</h1>
|
| 10 |
+
<hr>
|
| 11 |
+
<section class="ct-load-create flex flex-col gap-4 bg-gray-600 p-6 rounded-xl">
|
| 12 |
+
<p class="text-lg text-white text-center font-bold">
|
| 13 |
+
Estamos creando la sesion, por favor espere...
|
| 14 |
+
</p>
|
| 15 |
+
<hr class="text-white">
|
| 16 |
+
<div class="w-full h-4 bg-green-500 rounded-full overflow-hidden">
|
| 17 |
+
<div class="h-full bg-red-400 animate-pulse" style="width: 100%"></div>
|
| 18 |
+
</div>
|
| 19 |
+
</section>
|
| 20 |
+
<section class="ct-message-create flex flex-col gap-4 bg-gray-600 p-6 rounded-xl hidden"></section>
|
| 21 |
+
<form action="" method="post" class="hidden ct-cretae-session-form">
|
| 22 |
+
{% csrf_token %}
|
| 23 |
+
<input type="hidden" name="action" value="create_session">
|
| 24 |
+
</form>
|
| 25 |
+
</article>
|
| 26 |
+
</article>
|
| 27 |
+
{% endblock %}
|
| 28 |
+
|
| 29 |
+
{% block extra_js %}
|
| 30 |
+
<script src="{% static 'js/create-session.js' %}"></script>
|
| 31 |
+
{% endblock %}
|
tecnicas/urls.py
CHANGED
|
@@ -15,6 +15,7 @@ urlpatterns = [
|
|
| 15 |
path("panel-configuracion-tags", views.configurationPanelTags, name="panel_configuracion_tags"),
|
| 16 |
path("panel-configuracion-codes", views.configurationPanelCodes, name="panel_configuracion_codes"),
|
| 17 |
path("panel-configuracion-words", views.configurationPanelWords, name="panel_configuracion_words"),
|
|
|
|
| 18 |
path("nueva-etiqueta", views.newTag, name="nueva_etiqueta"),
|
| 19 |
path("crear-catador", views.testerCreate, name="crear_catador"),
|
| 20 |
path("buscar-catador", views.testerSearch, name="buscar_catador"),
|
|
|
|
| 15 |
path("panel-configuracion-tags", views.configurationPanelTags, name="panel_configuracion_tags"),
|
| 16 |
path("panel-configuracion-codes", views.configurationPanelCodes, name="panel_configuracion_codes"),
|
| 17 |
path("panel-configuracion-words", views.configurationPanelWords, name="panel_configuracion_words"),
|
| 18 |
+
path("creando-sesion", views.createSession, name="creando_sesion"),
|
| 19 |
path("nueva-etiqueta", views.newTag, name="nueva_etiqueta"),
|
| 20 |
path("crear-catador", views.testerCreate, name="crear_catador"),
|
| 21 |
path("buscar-catador", views.testerSearch, name="buscar_catador"),
|
tecnicas/views/__init__.py
CHANGED
|
@@ -11,4 +11,5 @@ from .configuration_panel_words import configurationPanelWords
|
|
| 11 |
from .api_tag import newTag
|
| 12 |
from .tester_create import testerCreate
|
| 13 |
from .tester_search import testerSearch
|
| 14 |
-
from .api_words import words
|
|
|
|
|
|
| 11 |
from .api_tag import newTag
|
| 12 |
from .tester_create import testerCreate
|
| 13 |
from .tester_search import testerSearch
|
| 14 |
+
from .api_words import words
|
| 15 |
+
from .create_session import createSession
|
tecnicas/views/configuration_panel_basic.py
CHANGED
|
@@ -4,7 +4,10 @@ from django.urls import reverse
|
|
| 4 |
from ..forms import SesionBasicForm
|
| 5 |
from ..models import TipoTecnica
|
| 6 |
|
|
|
|
| 7 |
def configurationPanelBasic(req: HttpRequest):
|
|
|
|
|
|
|
| 8 |
if req.method == "POST":
|
| 9 |
try:
|
| 10 |
form = SesionBasicForm(req.POST)
|
|
@@ -23,7 +26,7 @@ def configurationPanelBasic(req: HttpRequest):
|
|
| 23 |
except KeyError:
|
| 24 |
return redirect(reverse("cata_system:seleccion_tecnica") + "?error=error en datos de configuracion")
|
| 25 |
|
| 26 |
-
return render(req, "tecnicas/create_sesion/configuracion-panel-basic.html", {
|
| 27 |
elif req.method == "GET":
|
| 28 |
try:
|
| 29 |
id_tecnica = req.GET["id_tecnica"]
|
|
@@ -35,6 +38,6 @@ def configurationPanelBasic(req: HttpRequest):
|
|
| 35 |
|
| 36 |
if tecnica:
|
| 37 |
form_sesion = SesionBasicForm(id_tecnica_new=id_tecnica)
|
| 38 |
-
return render(req, "tecnicas/create_sesion/configuracion-panel-basic.html", {
|
| 39 |
else:
|
| 40 |
-
return redirect(reverse("cata_system:seleccion_tecnica") + "?error=la_tecnica_no_existe")
|
|
|
|
| 4 |
from ..forms import SesionBasicForm
|
| 5 |
from ..models import TipoTecnica
|
| 6 |
|
| 7 |
+
|
| 8 |
def configurationPanelBasic(req: HttpRequest):
|
| 9 |
+
req.session.flush()
|
| 10 |
+
|
| 11 |
if req.method == "POST":
|
| 12 |
try:
|
| 13 |
form = SesionBasicForm(req.POST)
|
|
|
|
| 26 |
except KeyError:
|
| 27 |
return redirect(reverse("cata_system:seleccion_tecnica") + "?error=error en datos de configuracion")
|
| 28 |
|
| 29 |
+
return render(req, "tecnicas/create_sesion/configuracion-panel-basic.html", {"form_sesion": form, "error": "Ha ocurrido un error al continuar al siguiente paso."})
|
| 30 |
elif req.method == "GET":
|
| 31 |
try:
|
| 32 |
id_tecnica = req.GET["id_tecnica"]
|
|
|
|
| 38 |
|
| 39 |
if tecnica:
|
| 40 |
form_sesion = SesionBasicForm(id_tecnica_new=id_tecnica)
|
| 41 |
+
return render(req, "tecnicas/create_sesion/configuracion-panel-basic.html", {"form_sesion": form_sesion})
|
| 42 |
else:
|
| 43 |
+
return redirect(reverse("cata_system:seleccion_tecnica") + "?error=la_tecnica_no_existe")
|
tecnicas/views/configuration_panel_words.py
CHANGED
|
@@ -26,17 +26,19 @@ def configurationPanelWords(req: HttpRequest):
|
|
| 26 |
|
| 27 |
words = json.loads(req.POST.get("words"))
|
| 28 |
context["words"] = words
|
| 29 |
-
|
| 30 |
ids_words = [word["id"] for word in words]
|
| 31 |
|
| 32 |
if len(ids_words) != len(set(ids_words)):
|
| 33 |
context["error"] = "existen palabras duplicadas"
|
| 34 |
return render(req, "tecnicas/create_sesion/configuracion-panel-words.html", context)
|
| 35 |
-
|
| 36 |
-
exist_words = Palabra.objects.filter(
|
|
|
|
| 37 |
|
| 38 |
if not exist_words:
|
| 39 |
context["error"] = "algunas palabras no existen"
|
| 40 |
return render(req, "tecnicas/create_sesion/configuracion-panel-words.html", context)
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
| 26 |
|
| 27 |
words = json.loads(req.POST.get("words"))
|
| 28 |
context["words"] = words
|
| 29 |
+
|
| 30 |
ids_words = [word["id"] for word in words]
|
| 31 |
|
| 32 |
if len(ids_words) != len(set(ids_words)):
|
| 33 |
context["error"] = "existen palabras duplicadas"
|
| 34 |
return render(req, "tecnicas/create_sesion/configuracion-panel-words.html", context)
|
| 35 |
+
|
| 36 |
+
exist_words = Palabra.objects.filter(
|
| 37 |
+
id__in=ids_words).count() == len(ids_words)
|
| 38 |
|
| 39 |
if not exist_words:
|
| 40 |
context["error"] = "algunas palabras no existen"
|
| 41 |
return render(req, "tecnicas/create_sesion/configuracion-panel-words.html", context)
|
| 42 |
|
| 43 |
+
req.session["form_words"] = ids_words
|
| 44 |
+
return redirect(reverse("cata_system:creando_sesion"))
|
tecnicas/views/create_session.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.http import HttpRequest, JsonResponse
|
| 2 |
+
from django.shortcuts import render, redirect
|
| 3 |
+
from django.urls import reverse
|
| 4 |
+
from ..utils import general_error
|
| 5 |
+
from ..controllers import TecnicaController
|
| 6 |
+
from ..models import TipoTecnica, EstiloPalabra
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def createSession(req: HttpRequest):
|
| 10 |
+
if req.method == "GET":
|
| 11 |
+
return render(req, 'tecnicas/create_sesion/creando_sesion.html')
|
| 12 |
+
if req.method == "POST":
|
| 13 |
+
if req.POST.get('action') == 'create_session':
|
| 14 |
+
if not req.session.get("form_basic") or not req.session.get("form_tags") or not req.session.get("form_codes") or not req.session["form_words"]:
|
| 15 |
+
req.session.flush()
|
| 16 |
+
return general_error("no se ha especificado informacion necesaria para la creacion de la sesion")
|
| 17 |
+
|
| 18 |
+
data_basic = req.session["form_basic"]
|
| 19 |
+
controllTechnique = TecnicaController()
|
| 20 |
+
controllTechnique.setTechniqueFromBasicData(basic=data_basic)
|
| 21 |
+
print(controllTechnique.getDataTechnique())
|
| 22 |
+
|
| 23 |
+
return JsonResponse({"message": "sesion creada", "data": {"session_id": "asd548ad4a"}})
|
| 24 |
+
return general_error("ha orcurrido un error inesperado")
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
{
|
| 28 |
+
'id_tecnica': 1,
|
| 29 |
+
'nombre_sesion': '',
|
| 30 |
+
'numero_productos': 3,
|
| 31 |
+
'numero_catadores': 3,
|
| 32 |
+
'numero_repeticiones': 3,
|
| 33 |
+
'estilo_palabras': 1,
|
| 34 |
+
'tipo_escala': 2,
|
| 35 |
+
'tamano_escala': 9,
|
| 36 |
+
'instrucciones': ''
|
| 37 |
+
}
|