Cambios Grandes, editro nuevo de preguntas, logica nueva con mas opciones de pregutnas con preguntas hijos hasta 5 niveles
This commit is contained in:
@@ -65,18 +65,19 @@ class Question(Base):
|
||||
checklist_id = Column(Integer, ForeignKey("checklists.id"), nullable=False)
|
||||
section = Column(String(100)) # Sistema eléctrico, Frenos, etc
|
||||
text = Column(Text, nullable=False)
|
||||
type = Column(String(30), nullable=False) # pass_fail, good_bad, text, etc
|
||||
type = Column(String(30), nullable=False) # boolean, single_choice, multiple_choice, scale, text, number, date, time
|
||||
points = Column(Integer, default=1)
|
||||
options = Column(JSON) # Para multiple choice
|
||||
options = Column(JSON) # Configuración flexible según tipo de pregunta
|
||||
order = Column(Integer, default=0)
|
||||
allow_photos = Column(Boolean, default=True)
|
||||
max_photos = Column(Integer, default=3)
|
||||
requires_comment_on_fail = Column(Boolean, default=False)
|
||||
send_notification = Column(Boolean, default=False)
|
||||
|
||||
# Conditional logic
|
||||
# Conditional logic - Subpreguntas anidadas hasta 5 niveles
|
||||
parent_question_id = Column(Integer, ForeignKey("questions.id"), nullable=True)
|
||||
show_if_answer = Column(String(50), nullable=True) # Valor que dispara esta pregunta
|
||||
depth_level = Column(Integer, default=0) # 0=principal, 1-5=subpreguntas anidadas
|
||||
|
||||
# AI Analysis
|
||||
ai_prompt = Column(Text, nullable=True) # Prompt personalizado para análisis de IA de esta pregunta
|
||||
|
||||
@@ -94,12 +94,27 @@ class Checklist(ChecklistBase):
|
||||
|
||||
|
||||
# Question Schemas
|
||||
# Tipos de preguntas soportados:
|
||||
# - boolean: Dos opciones personalizables (ej: Sí/No, Pasa/Falla)
|
||||
# - single_choice: Selección única con N opciones
|
||||
# - multiple_choice: Selección múltiple
|
||||
# - scale: Escala numérica (1-5, 1-10, etc.)
|
||||
# - text: Texto libre
|
||||
# - number: Valor numérico
|
||||
# - date: Fecha
|
||||
# - time: Hora
|
||||
|
||||
class QuestionBase(BaseModel):
|
||||
section: Optional[str] = None
|
||||
text: str
|
||||
type: str
|
||||
type: str # boolean, single_choice, multiple_choice, scale, text, number, date, time
|
||||
points: int = 1
|
||||
options: Optional[dict] = None
|
||||
options: Optional[dict] = None # Configuración flexible según tipo
|
||||
# Estructura de options:
|
||||
# Boolean: {"type": "boolean", "choices": [{"value": "yes", "label": "Sí", "points": 1, "status": "ok"}, ...]}
|
||||
# Single/Multiple Choice: {"type": "single_choice", "choices": [{"value": "opt1", "label": "Opción 1", "points": 2}, ...]}
|
||||
# Scale: {"type": "scale", "min": 1, "max": 5, "step": 1, "labels": {"min": "Muy malo", "max": "Excelente"}}
|
||||
# Text: {"type": "text", "multiline": true, "max_length": 500}
|
||||
order: int = 0
|
||||
allow_photos: bool = True
|
||||
max_photos: int = 3
|
||||
|
||||
Reference in New Issue
Block a user