@@ -718,16 +718,16 @@ def get_student_results(
718718 "message" : f"Student not found: { student_name or student_id } " ,
719719 }
720720
721- student_id = student ["student_id" ]
722- student_name = student ["name" ]
723- exams = db .get_student_exams (student_id )
721+ student_id_value : str = student ["student_id" ]
722+ student_name_value : str = student ["name" ]
723+ exams = db .get_student_exams (student_id_value )
724724
725725 if not exams :
726726 return {
727727 "status" : "success" ,
728- "message" : f"No exams recorded for { student_name } ." ,
729- "student_name" : student_name ,
730- "student_id" : student_id ,
728+ "message" : f"No exams recorded for { student_name_value } ." ,
729+ "student_name" : student_name_value ,
730+ "student_id" : student_id_value ,
731731 "exams" : [],
732732 }
733733
@@ -749,8 +749,8 @@ def get_student_results(
749749
750750 return {
751751 "status" : "success" ,
752- "student_name" : student_name ,
753- "student_id" : student_id ,
752+ "student_name" : student_name_value ,
753+ "student_id" : student_id_value ,
754754 "summary" : {
755755 "total_exams" : len (exams ),
756756 "average_percentage" : round (avg_percentage , 1 ),
@@ -850,7 +850,7 @@ def get_class_analytics(tool_context: ToolContext) -> Dict[str, Any]:
850850 lowest = min (student_performances , key = lambda s : s ["average_percentage" ])
851851
852852 # Find common weaknesses
853- weakness_counts = {}
853+ weakness_counts : Dict [ str , int ] = {}
854854 for w in all_class_weaknesses :
855855 topic = w .get ("topic" , "Unknown" )
856856 weakness_counts [topic ] = weakness_counts .get (topic , 0 ) + 1
@@ -979,17 +979,24 @@ def get_learning_recommendations(
979979 db = system .db
980980
981981 # Find student
982- if not student_id :
982+ student_id_value : Optional [str ] = student_id
983+ if not student_id_value :
983984 student = db .get_student_by_name (student_name ) if student_name else None
984985 if not student :
985986 return {
986987 "status" : "error" ,
987988 "message" : f"Student not found: { student_name } " ,
988989 }
989- student_id = student ["student_id" ]
990+ student_id_value = student ["student_id" ]
991+
992+ if not student_id_value :
993+ return {
994+ "status" : "error" ,
995+ "message" : "Student ID not available for recommendations." ,
996+ }
990997
991998 # Get latest exam with recommendations
992- exams = db .get_student_exams (student_id )
999+ exams = db .get_student_exams (student_id_value )
9931000
9941001 if not exams :
9951002 return {
0 commit comments