Ajuste de mensajes de notificaciones y resolucion de notificaciones duplicadas backend 1.0.40
This commit is contained in:
@@ -1090,9 +1090,24 @@ def create_answer(
|
||||
db.commit()
|
||||
db.refresh(existing_answer)
|
||||
|
||||
# Enviar notificación si la pregunta lo requiere
|
||||
if question.send_notification:
|
||||
# Enviar notificación si la pregunta lo requiere Y hay un valor real
|
||||
print(f"\n=== DEBUG NOTIFICACIÓN (UPDATE) ===")
|
||||
print(f"Pregunta ID: {question.id}")
|
||||
print(f"Texto: {question.text}")
|
||||
print(f"send_notification: {question.send_notification}")
|
||||
print(f"answer_value: '{answer.answer_value}'")
|
||||
print(f"Tiene valor: {bool(answer.answer_value)}")
|
||||
print(f"===================================\n")
|
||||
|
||||
# Solo enviar si tiene valor real (no vacío ni None)
|
||||
if question.send_notification and answer.answer_value:
|
||||
print(f"✅ Enviando notificación para pregunta #{question.id}")
|
||||
send_answer_notification(existing_answer, question, current_user, db)
|
||||
else:
|
||||
if not question.send_notification:
|
||||
print(f"❌ NO se envía notificación (send_notification=False) para pregunta #{question.id}")
|
||||
else:
|
||||
print(f"⏭️ NO se envía notificación (respuesta vacía) para pregunta #{question.id}")
|
||||
|
||||
return existing_answer
|
||||
else:
|
||||
@@ -1108,9 +1123,17 @@ def create_answer(
|
||||
db.commit()
|
||||
db.refresh(db_answer)
|
||||
|
||||
# Enviar notificación si la pregunta lo requiere
|
||||
if question.send_notification:
|
||||
|
||||
|
||||
# Solo enviar si tiene valor real (no vacío ni None)
|
||||
if question.send_notification and answer.answer_value:
|
||||
print(f"✅ Enviando notificación para pregunta #{question.id}")
|
||||
send_answer_notification(db_answer, question, current_user, db)
|
||||
else:
|
||||
if not question.send_notification:
|
||||
print(f"❌ NO se envía notificación (send_notification=False) para pregunta #{question.id}")
|
||||
else:
|
||||
print(f"⏭️ NO se envía notificación (respuesta vacía) para pregunta #{question.id}")
|
||||
|
||||
return db_answer
|
||||
|
||||
|
||||
Reference in New Issue
Block a user