Fix user name preservation in save_checklist - Preserve existing userName from mobile app instead of overriding it
Browse files
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 |
-
#
|
| 595 |
-
|
| 596 |
-
|
| 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')
|