Fix automatic checklist creation - Return default checklist structure without saving to database when user enters name
Browse files
app.py
CHANGED
|
@@ -425,8 +425,8 @@ async def get_checklist(user_id: str):
|
|
| 425 |
)
|
| 426 |
|
| 427 |
if not checklist_doc:
|
| 428 |
-
#
|
| 429 |
-
logger.info(f"No checklist found for user {user_id},
|
| 430 |
|
| 431 |
# Default checklist structure - Complete 38-item audit checklist
|
| 432 |
default_checklist = {
|
|
@@ -530,10 +530,8 @@ async def get_checklist(user_id: str):
|
|
| 530 |
"updatedAt": datetime.utcnow()
|
| 531 |
}
|
| 532 |
|
| 533 |
-
#
|
| 534 |
-
|
| 535 |
-
checklist_doc = await db.checklists.find_one({"_id": result.inserted_id})
|
| 536 |
-
logger.info(f"Created new checklist for user {user_id}")
|
| 537 |
|
| 538 |
# Serialize the document
|
| 539 |
serialized_checklist = serialize_checklist(checklist_doc)
|
|
|
|
| 425 |
)
|
| 426 |
|
| 427 |
if not checklist_doc:
|
| 428 |
+
# Return default checklist structure without saving to database
|
| 429 |
+
logger.info(f"No checklist found for user {user_id}, returning default structure")
|
| 430 |
|
| 431 |
# Default checklist structure - Complete 38-item audit checklist
|
| 432 |
default_checklist = {
|
|
|
|
| 530 |
"updatedAt": datetime.utcnow()
|
| 531 |
}
|
| 532 |
|
| 533 |
+
# Return the default checklist without saving to database
|
| 534 |
+
checklist_doc = default_checklist
|
|
|
|
|
|
|
| 535 |
|
| 536 |
# Serialize the document
|
| 537 |
serialized_checklist = serialize_checklist(checklist_doc)
|