Ali2206 commited on
Commit
1552bf8
·
verified ·
1 Parent(s): 592ea39

Update api/routes.py

Browse files
Files changed (1) hide show
  1. api/routes.py +2 -5
api/routes.py CHANGED
@@ -195,12 +195,9 @@ async def list_doctor_appointments(current_user: dict = Depends(get_current_user
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
 
 
195
  appointments = []
196
 
197
  async for a in cursor:
198
+ patient_id = a.get("patient_id")
199
  try:
200
+ patient = await users_collection.find_one({"_id": ObjectId(patient_id)})
 
 
 
 
201
  except Exception:
202
  patient = None
203