Spaces:
Running
Running
Capturando datos de escalas continuas y modificnado el ancho de las mismas escalas
Browse files- tecnicas/static/js/created-scale.js +28 -2
- tecnicas/templates/tecnicas/forms_tester/convencional.html +8 -7
- tecnicas/templates/tecnicas/layouts/base.html +1 -1
- tecnicas/urls.py +4 -0
- tecnicas/views/__init__.py +1 -0
- tecnicas/views/apis/rating_word.py +17 -0
- tecnicas/views/tester_forms/convencional_scales.py +25 -0
tecnicas/static/js/created-scale.js
CHANGED
|
@@ -20,11 +20,12 @@ function cancelSendRating(word) {
|
|
| 20 |
|
| 21 |
async function sendRating(word) {
|
| 22 |
const formRatingWord = document.querySelector(`.form-rating-${word}`);
|
| 23 |
-
console.log(formRatingWord);
|
| 24 |
|
| 25 |
-
const dataForm = new FormData(
|
| 26 |
const url = "/cata/testers/api/ratingword";
|
| 27 |
|
|
|
|
|
|
|
| 28 |
try {
|
| 29 |
const respone = await fetch(url, {
|
| 30 |
method: "POST",
|
|
@@ -42,7 +43,32 @@ async function sendRating(word) {
|
|
| 42 |
}
|
| 43 |
|
| 44 |
console.log(jsonResponse);
|
|
|
|
| 45 |
} catch (error) {
|
| 46 |
console.log("Error:", error);
|
| 47 |
}
|
| 48 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
async function sendRating(word) {
|
| 22 |
const formRatingWord = document.querySelector(`.form-rating-${word}`);
|
|
|
|
| 23 |
|
| 24 |
+
const dataForm = new FormData(formRatingWord);
|
| 25 |
const url = "/cata/testers/api/ratingword";
|
| 26 |
|
| 27 |
+
dataForm.set("name-word", word);
|
| 28 |
+
|
| 29 |
try {
|
| 30 |
const respone = await fetch(url, {
|
| 31 |
method: "POST",
|
|
|
|
| 43 |
}
|
| 44 |
|
| 45 |
console.log(jsonResponse);
|
| 46 |
+
remplaceForm(formRatingWord, jsonResponse.message);
|
| 47 |
} catch (error) {
|
| 48 |
console.log("Error:", error);
|
| 49 |
}
|
| 50 |
}
|
| 51 |
+
|
| 52 |
+
function remplaceForm(oldForm, message) {
|
| 53 |
+
const articleContainer = document.createElement("article");
|
| 54 |
+
const thankYouMessage = document.createElement("p");
|
| 55 |
+
const messageResponse = document.createElement("p");
|
| 56 |
+
|
| 57 |
+
thankYouMessage.textContent =
|
| 58 |
+
"Palabra calificada, gracias por la participación";
|
| 59 |
+
messageResponse.textContent = message;
|
| 60 |
+
|
| 61 |
+
articleContainer.classList.add(
|
| 62 |
+
"bg-gray-200",
|
| 63 |
+
"p-6",
|
| 64 |
+
"rounded-lg",
|
| 65 |
+
"mb-3",
|
| 66 |
+
"text-center"
|
| 67 |
+
);
|
| 68 |
+
thankYouMessage.classList.add("text-2xl", "font-bold");
|
| 69 |
+
messageResponse.classList.add("text-lg");
|
| 70 |
+
|
| 71 |
+
articleContainer.appendChild(thankYouMessage);
|
| 72 |
+
articleContainer.appendChild(messageResponse);
|
| 73 |
+
oldForm.replaceWith(articleContainer);
|
| 74 |
+
}
|
tecnicas/templates/tecnicas/forms_tester/convencional.html
CHANGED
|
@@ -97,12 +97,12 @@
|
|
| 97 |
</section>
|
| 98 |
</article>
|
| 99 |
|
| 100 |
-
|
| 101 |
-
|
| 102 |
{% for word in words %}
|
| 103 |
<form action="" method="post" class="form-rating-{{word}}">
|
| 104 |
{% csrf_token %}
|
| 105 |
-
<article class="bg-gray-200 p-6 rounded-lg mb-3">
|
| 106 |
<label for="id-range-word-{{word}}"
|
| 107 |
class="text-xl font-bold tracking-wide block mb-6 first-letter:uppercase">{{ word }}</label>
|
| 108 |
|
|
@@ -110,7 +110,8 @@
|
|
| 110 |
<div class="relative">
|
| 111 |
<input id="id-range-word-{{word}}" type="range" min="0" max="1000" value="500"
|
| 112 |
name="rating-word"
|
| 113 |
-
class="
|
|
|
|
| 114 |
|
| 115 |
<div class="absolute top-0 left-0 w-0.5 transform -translate-x-1/2 h-full bg-red-500 z-10">
|
| 116 |
</div>
|
|
@@ -125,8 +126,8 @@
|
|
| 125 |
|
| 126 |
<div class="flex justify-between mt-4">
|
| 127 |
{% for tag in tags %}
|
| 128 |
-
<div class="flex flex-col items-start text-left w-[
|
| 129 |
-
<span class="text-
|
| 130 |
{{ tag.id_etiqueta }}
|
| 131 |
</span>
|
| 132 |
</div>
|
|
@@ -150,8 +151,8 @@
|
|
| 150 |
</article>
|
| 151 |
</form>
|
| 152 |
{% endfor %}
|
|
|
|
| 153 |
</article>
|
| 154 |
-
{% endif %}
|
| 155 |
</article>
|
| 156 |
</article>
|
| 157 |
{% endblock %}
|
|
|
|
| 97 |
</section>
|
| 98 |
</article>
|
| 99 |
|
| 100 |
+
<article class="scale-continue-container [&>*:not(:last-child)]:mb-5 flex flex-col items-center justify-center">
|
| 101 |
+
{% if type_scale == "continua" %}
|
| 102 |
{% for word in words %}
|
| 103 |
<form action="" method="post" class="form-rating-{{word}}">
|
| 104 |
{% csrf_token %}
|
| 105 |
+
<article class="bg-gray-200 p-6 rounded-lg mb-3 w-fit">
|
| 106 |
<label for="id-range-word-{{word}}"
|
| 107 |
class="text-xl font-bold tracking-wide block mb-6 first-letter:uppercase">{{ word }}</label>
|
| 108 |
|
|
|
|
| 110 |
<div class="relative">
|
| 111 |
<input id="id-range-word-{{word}}" type="range" min="0" max="1000" value="500"
|
| 112 |
name="rating-word"
|
| 113 |
+
class="h-2 bg-gray-400 rounded-lg appearance-none cursor-pointer slider"
|
| 114 |
+
style="width: {{scale.longitud}}cm;">
|
| 115 |
|
| 116 |
<div class="absolute top-0 left-0 w-0.5 transform -translate-x-1/2 h-full bg-red-500 z-10">
|
| 117 |
</div>
|
|
|
|
| 126 |
|
| 127 |
<div class="flex justify-between mt-4">
|
| 128 |
{% for tag in tags %}
|
| 129 |
+
<div class="flex flex-col items-start text-left w-[100px]">
|
| 130 |
+
<span class="text-xs font-medium text-gray-700 break-words first-letter:capitalize">
|
| 131 |
{{ tag.id_etiqueta }}
|
| 132 |
</span>
|
| 133 |
</div>
|
|
|
|
| 151 |
</article>
|
| 152 |
</form>
|
| 153 |
{% endfor %}
|
| 154 |
+
{% endif %}
|
| 155 |
</article>
|
|
|
|
| 156 |
</article>
|
| 157 |
</article>
|
| 158 |
{% endblock %}
|
tecnicas/templates/tecnicas/layouts/base.html
CHANGED
|
@@ -18,7 +18,7 @@
|
|
| 18 |
</head>
|
| 19 |
|
| 20 |
<body>
|
| 21 |
-
<main class="flex flex-col w-screen h-screen overflow-x-hidden overflow-y-scroll bg-gray-600">
|
| 22 |
{% block content %}{% endblock %}
|
| 23 |
</main>
|
| 24 |
|
|
|
|
| 18 |
</head>
|
| 19 |
|
| 20 |
<body>
|
| 21 |
+
<main class="flex flex-col w-screen max-sm:w-full h-screen overflow-x-hidden max-xs:overflow-x-scroll overflow-y-scroll bg-gray-600">
|
| 22 |
{% block content %}{% endblock %}
|
| 23 |
</main>
|
| 24 |
|
tecnicas/urls.py
CHANGED
|
@@ -84,4 +84,8 @@ urlpatterns = [
|
|
| 84 |
path("api/palabras",
|
| 85 |
views.words,
|
| 86 |
name="api_palabras"),
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
]
|
|
|
|
| 84 |
path("api/palabras",
|
| 85 |
views.words,
|
| 86 |
name="api_palabras"),
|
| 87 |
+
|
| 88 |
+
path("testers/api/ratingword",
|
| 89 |
+
views.reatingWord,
|
| 90 |
+
name="api_rating_word"),
|
| 91 |
]
|
tecnicas/views/__init__.py
CHANGED
|
@@ -18,6 +18,7 @@ from .tester_management.tester_search import testerSearch
|
|
| 18 |
|
| 19 |
from .apis.api_tag import newTag
|
| 20 |
from .apis.api_words import words
|
|
|
|
| 21 |
|
| 22 |
from .tester_forms.main_tester_form import mainTesterForm
|
| 23 |
from .tester_forms.convencional_scales import convencionalScales
|
|
|
|
| 18 |
|
| 19 |
from .apis.api_tag import newTag
|
| 20 |
from .apis.api_words import words
|
| 21 |
+
from .apis.rating_word import reatingWord
|
| 22 |
|
| 23 |
from .tester_forms.main_tester_form import mainTesterForm
|
| 24 |
from .tester_forms.convencional_scales import convencionalScales
|
tecnicas/views/apis/rating_word.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.http import HttpRequest, JsonResponse
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
def reatingWord(req: HttpRequest):
|
| 5 |
+
if req.method == "POST":
|
| 6 |
+
if not req.POST["rating-word"]:
|
| 7 |
+
return JsonResponse({"error": "No se ha reconocido valor para la calificacion"})
|
| 8 |
+
rating = req.POST["rating-word"]
|
| 9 |
+
word = req.POST["name-word"]
|
| 10 |
+
return JsonResponse({
|
| 11 |
+
"message": "Ok",
|
| 12 |
+
"data": {
|
| 13 |
+
"word": word,
|
| 14 |
+
"rating": rating,
|
| 15 |
+
"cata_ser": req.session["cata_username"]
|
| 16 |
+
}
|
| 17 |
+
})
|
tecnicas/views/tester_forms/convencional_scales.py
CHANGED
|
@@ -6,6 +6,9 @@ from ...controllers import SesionController, PosicionController, CalificacionCon
|
|
| 6 |
'''
|
| 7 |
**** Esta vista para sesion con tecnica convencional de escalas, al entrar debe:
|
| 8 |
**** ****
|
|
|
|
|
|
|
|
|
|
| 9 |
* Obtner los productos que se evaluan en la tecnica
|
| 10 |
* Ordenar los productos segun la Poscion en que se encuentre en el Orden ya establecidos
|
| 11 |
* Obtner las palabras para evaluar
|
|
@@ -33,6 +36,28 @@ from ...controllers import SesionController, PosicionController, CalificacionCon
|
|
| 33 |
- Comprobar que palabras no estan tienen dato
|
| 34 |
- Mandar palabras para el usuario
|
| 35 |
* Obtener informacion de la escala para mandar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
'''
|
| 37 |
|
| 38 |
|
|
|
|
| 6 |
'''
|
| 7 |
**** Esta vista para sesion con tecnica convencional de escalas, al entrar debe:
|
| 8 |
**** ****
|
| 9 |
+
|
| 10 |
+
++++ Por el lado del servidor
|
| 11 |
+
++++ ++++
|
| 12 |
* Obtner los productos que se evaluan en la tecnica
|
| 13 |
* Ordenar los productos segun la Poscion en que se encuentre en el Orden ya establecidos
|
| 14 |
* Obtner las palabras para evaluar
|
|
|
|
| 36 |
- Comprobar que palabras no estan tienen dato
|
| 37 |
- Mandar palabras para el usuario
|
| 38 |
* Obtener informacion de la escala para mandar
|
| 39 |
+
|
| 40 |
+
++++ Por el lado del cliente
|
| 41 |
+
++++ ++++
|
| 42 |
+
+ Mostrar en todo momento las instrucciones en la parte superior de la pagina
|
| 43 |
+
+ Mostrar la repeticion en la que esta
|
| 44 |
+
+ Mostrar el producto que esta calificando
|
| 45 |
+
+ Desglozar las palabras para calificar
|
| 46 |
+
- Cada palabra debe contar con su input segun el tipo
|
| 47 |
+
- Para cada input se debe poder guardar la calificacion
|
| 48 |
+
- Anstes de guardar la calificacion preguntar por la confirmacion a la hora de guardar el dato
|
| 49 |
+
- Especficar las etiquetas por debajo del input de ripo ranto
|
| 50 |
+
- Para las escalas de tipo continua
|
| 51 |
+
- La longitud de la barra de la escala debe ser igual al tamaño que se especifico en la configuracion
|
| 52 |
+
- Contar con un input de tipo range
|
| 53 |
+
- Contar con etiqueta en el inicio de la barra, en el medio y al final
|
| 54 |
+
- La escala debe terner marcas al inicio, medio y final
|
| 55 |
+
- El rango de la barra debe ir de 0 a 1000
|
| 56 |
+
- Para las escalas de tipo estructurada
|
| 57 |
+
- Su longitud sera tan largo como el contendor que lo aloja
|
| 58 |
+
- La barra se divide segun el numero de etiquetas que estas posean
|
| 59 |
+
- Cata longitud debe poser una marca y solo estas seran las unicas posibles respuestas
|
| 60 |
+
- Cata segmento en el que se dibide debe tener la etiqueda correspondiente por debaj
|
| 61 |
'''
|
| 62 |
|
| 63 |
|