Spaces:
Sleeping
Sleeping
Update api/routes.py
Browse files- api/routes.py +5 -2
api/routes.py
CHANGED
|
@@ -195,9 +195,12 @@ async def list_doctor_appointments(current_user: dict = Depends(get_current_user
|
|
| 195 |
appointments = []
|
| 196 |
|
| 197 |
async for a in cursor:
|
| 198 |
-
patient_id = a.get("patient_id")
|
| 199 |
try:
|
| 200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
except Exception:
|
| 202 |
patient = None
|
| 203 |
|
|
|
|
| 195 |
appointments = []
|
| 196 |
|
| 197 |
async for a in cursor:
|
|
|
|
| 198 |
try:
|
| 199 |
+
patient_id = a.get("patient_id")
|
| 200 |
+
if not isinstance(patient_id, ObjectId):
|
| 201 |
+
patient_id = ObjectId(patient_id)
|
| 202 |
+
|
| 203 |
+
patient = await users_collection.find_one({"_id": patient_id})
|
| 204 |
except Exception:
|
| 205 |
patient = None
|
| 206 |
|