Ali2206 commited on
Commit
12a44fb
·
1 Parent(s): 3d48b7c

Fix user name preservation in save_checklist - Preserve existing userName from mobile app instead of overriding it

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -591,9 +591,9 @@ async def save_checklist(user_id: str, checklist_data: dict):
591
  if 'metadata' not in checklist_dict:
592
  checklist_dict['metadata'] = {}
593
 
594
- # Add user name from metadata if available, or use a default
595
- user_name = checklist_dict['metadata'].get('userName', 'Unknown User')
596
- checklist_dict['metadata']['userName'] = user_name
597
  checklist_dict['metadata']['userId'] = user_id
598
  checklist_dict['metadata']['savedAt'] = datetime.utcnow().isoformat()
599
  checklist_dict['metadata']['savedAtFormatted'] = datetime.utcnow().strftime('%d/%m/%Y, %H:%M:%S')
 
591
  if 'metadata' not in checklist_dict:
592
  checklist_dict['metadata'] = {}
593
 
594
+ # Preserve existing userName or set default
595
+ if 'userName' not in checklist_dict['metadata']:
596
+ checklist_dict['metadata']['userName'] = 'Unknown User'
597
  checklist_dict['metadata']['userId'] = user_id
598
  checklist_dict['metadata']['savedAt'] = datetime.utcnow().isoformat()
599
  checklist_dict['metadata']['savedAtFormatted'] = datetime.utcnow().strftime('%d/%m/%Y, %H:%M:%S')