File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
flaskAIservices/src/controllers Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -330,3 +330,31 @@ def send_report():
330330 except Exception as e :
331331 print (f"Error in send_report: { str (e )} " )
332332 return jsonify ({"error" : str (e )}), 500
333+
334+ @emotion_detection_route .route ("/reset" , methods = ["POST" ])
335+ def reset_emotion_data ():
336+ try :
337+ # Get student ID and activity ID from headers
338+ student_id = request .headers .get ('Student-Id' )
339+ activity_id = request .headers .get ('Activity-Id' )
340+
341+ if not student_id or not activity_id :
342+ return jsonify ({"error" : "Student ID and Activity ID are required" }), 400
343+
344+ # Delete all emotion data for this student and activity
345+ collection .delete_many ({
346+ "StudentId" : student_id ,
347+ "ActivityId" : activity_id
348+ })
349+
350+ return jsonify ({
351+ "message" : "Emotion data reset successfully" ,
352+ "percentages" : {
353+ "frustration" : 0 ,
354+ "distraction" : 0 ,
355+ "engagement" : 0
356+ }
357+ }), 200
358+
359+ except Exception as e :
360+ return jsonify ({"error" : str (e )}), 500
You can’t perform that action at this time.
0 commit comments