Ali2206 commited on
Commit
546abe0
·
1 Parent(s): 12a44fb

Fix automatic checklist creation - Return default checklist structure without saving to database when user enters name

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -425,8 +425,8 @@ async def get_checklist(user_id: str):
425
  )
426
 
427
  if not checklist_doc:
428
- # Create new checklist if none exists
429
- logger.info(f"No checklist found for user {user_id}, creating new one")
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
- # Insert the new checklist
534
- result = await db.checklists.insert_one(default_checklist)
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)