You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#python3 `\backend\app.py`
list_of_drivers_id= [laptime_dict.get('driver_id') for laptime_dict in tracks_laptime_dicts
# Use $in to find tracks with matching track_ids
drivers = db.drivers.find({'id': {'$in': list_of_drivers_id}}, {'_id': False})
driver_dicts = [driver for driver in drivers]
if drivers:
# Convert the result to a list of dictionaries
return jsonify(driver_dicts)
#else wouldnt even work, it rathers returns empty array
if the entry doesnt exist, we should return 'entry not found'. it returns [ ], when querying the server.
The text was updated successfully, but these errors were encountered:
ifdrivers:
# Convert the result to a list of dictionariesreturnjsonify(driver_dicts)
``` andnot:
``` pythonifdriver_dicts:
# Convert the result to a list of dictionariesreturnjsonify(driver_dicts)
Since driver_dicts is a list of drivers it would check the condition will check if the driver exist with the id(indirectly) exit if not and the list is empty it would return "Entry not found"
ifdrivers:
# Convert the result to a list of dictionariesreturnjsonify(driver_dicts)
``` andnot:
``` pythonifdriver_dicts:
# Convert the result to a list of dictionariesreturnjsonify(driver_dicts)
Since driver_dicts is a list of drivers it would check the condition will check if the driver exist with the id(indirectly) exit if not and the list is empty it would return "Entry not found"
yeah you are very correct, i will work on implementing the fix 👍
if the entry doesnt exist, we should return 'entry not found'. it returns [ ], when querying the server.
The text was updated successfully, but these errors were encountered: