윤영준 윤영준 2024-07-17
Added a exception handler for : for api endpoint action/gps_update, when trip_log is empty, returns error to client instead of just not inserting any rows.
@f5521d5783f73a1c141e6aa60635b230ab5dd6d3
action.py
--- action.py
+++ action.py
@@ -168,6 +168,9 @@
         data = request.get_json()
         if len(data["trip_id"]) !=64:
             return jsonify({500 :"ERROR! INVALID TRIP_ID!"})
+            
+        if len(data["trip_log"]["timestamp"]) == 0:
+            return jsonify({500 :"ERROR! 'trip_log' is empty!"})
          
         df = pd.DataFrame(data["trip_log"])
         df["user_id"] = data["user_id"]
Add a comment
List