diff --git a/backend/app/main.py b/backend/app/main.py index 230f509..cb20675 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -209,7 +209,7 @@ def send_completed_inspection_to_n8n(inspection, db): # No lanzamos excepción para no interrumpir el flujo normal -BACKEND_VERSION = "1.0.91" +BACKEND_VERSION = "1.0.92" app = FastAPI(title="Checklist Inteligente API", version=BACKEND_VERSION) # S3/MinIO configuration diff --git a/frontend/package.json b/frontend/package.json index f8ab1f1..80f2e78 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "checklist-frontend", "private": true, - "version": "1.0.94", + "version": "1.0.95", "type": "module", "scripts": { "dev": "vite", diff --git a/frontend/public/service-worker.js b/frontend/public/service-worker.js index 78a1ed5..8569123 100644 --- a/frontend/public/service-worker.js +++ b/frontend/public/service-worker.js @@ -1,6 +1,6 @@ // Service Worker para PWA con detección de actualizaciones // IMPORTANTE: Actualizar esta versión cada vez que se despliegue una nueva versión -const CACHE_NAME = 'ayutec-v1.0.94'; +const CACHE_NAME = 'ayutec-v1.0.95'; const urlsToCache = [ '/', '/index.html' diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 8d2f7a0..e381aa2 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1459,10 +1459,11 @@ function QuestionsManagerModal({ checklist, onClose }) { // Solo subpreguntas del mismo padre questionsList = questions.filter(q => q.parent_question_id === draggedQuestion.parent_question_id - ) + ).sort((a, b) => a.order - b.order) // Ordenar por order actual } else { // Solo preguntas padre (sin parent_question_id) questionsList = questions.filter(q => !q.parent_question_id) + .sort((a, b) => a.order - b.order) // Ordenar por order actual } const draggedIndex = questionsList.findIndex(q => q.id === draggedQuestion.id) @@ -1473,10 +1474,11 @@ function QuestionsManagerModal({ checklist, onClose }) { const [movedQuestion] = newList.splice(draggedIndex, 1) newList.splice(targetIndex, 0, movedQuestion) - // Preparar datos para el backend (solo las preguntas afectadas) + // Preparar datos para el backend usando los valores de 'order' originales + // Esto mantiene el orden relativo correcto con respecto a otras preguntas const reorderData = newList.map((q, index) => ({ question_id: q.id, - new_order: index + new_order: questionsList[index].order // Usar el order de la posición correspondiente })) try { @@ -1506,7 +1508,11 @@ function QuestionsManagerModal({ checklist, onClose }) { setDragOverQuestion(null) } - const questionsBySection = questions.reduce((acc, q) => { + // Primero ordenar todas las preguntas por el campo 'order' para mantener el orden del backend + const sortedQuestions = [...questions].sort((a, b) => a.order - b.order) + + // Luego agrupar por sección manteniendo el orden + const questionsBySection = sortedQuestions.reduce((acc, q) => { const section = q.section || 'Sin sección' if (!acc[section]) acc[section] = [] acc[section].push(q) @@ -1867,7 +1873,14 @@ function QuestionsManagerModal({ checklist, onClose }) { ) : (