def put(self, student_id): """ Updates a student attendance given a date range, class and student_id. Param: student_id: Student id. Request: path: api/v0/attendance/student body: { "start_date": "16-05-2020", "end_date": "18-05-2020", "status": "P", }, accept: application/json Response: return None, 201 content-type: application/json """ if not student_id: return { "error": "Mandatory parameter student id not supplied" }, 400 request_payload = request.json start_date = request_payload['start_date'] end_date = request_payload['end_date'] status = request_payload['status'] attendance_handler = AttendanceHandler() print('Making request to the handler to post the students data') attendance_handler.PutStudentAttendance(student_id, start_date, end_date, status)
def get(self, student_id): """ Gets a student attendance given a date range, class and student_id. Param: student_id: Student id. Request: path: api/v0/attendance/student body: { "start_date": "16-05-2020", "end_date": "18-05-2020", }, # Date format can be iso or "dd-m-YYYY" accept: application/json Response: return { attendance: [{"name": "Shivam Kapoor", "date": "2020-06-25", "status": "P"},], }, 200 content-type: application/json """ if not student_id: return { "error": "Mandatory parameter student id not supplied" }, 400 start_date = request.args.get('start_date') end_date = request.args.get('end_date') attendance_handler = AttendanceHandler() print('Making request to the handler to get the students data') return jsonify( attendance_handler.GetStudentAttendance(student_id, **request.args))
def put(self, class_id): """ Updates students attendance given a date and class. Param: class_id: Class entity id. Request: path: api/v0/attendance/class body: { "attendance": [ {"name": "Shivam Kapoor", "roll_no: "1", "status": "P"}, {"name": "Tiwari Seth", "roll_no: "2", "status": "A"}, ], "date": "16-05-2020" } Response: None, 202 """ if not class_id: return {"error": "Mandatory parameter class id not supplied"}, 400 request_payload = request.json for attendance_record in request_payload: roll_no = attendance_record['roll_no'] start_date = attendance_record['start_date'] end_date = attendance_record['end_date'] status = attendance_record['status'] attendance_handler = AttendanceHandler() print('Making request to the handler to post the students data') attendance_handler.UpdateStudentsAttendance( class_id, roll_no, start_date, end_date, status)
def get(self, class_id): """ Gets students attendance given a date and class. Param: class_id: Class entity id. Request: path: api/v0/attendance/class body: { "date": "16-05-2020" }, accept: application/json Response: if attendance is there for a date: return { attendance: [{"name": "Shivam Kapoor", "roll_no: "1", "status": "P"},], date: "16-05-2020" }, 200 return "Attendance is not calculated for the date: {date}", 400 content-type: application/json """ if not class_id: return {"error": "Mandatory parameter class id not supplied"}, 400 start_date = request.args.get('start_date') end_date = request.args.get('end_date') attendance_handler = AttendanceHandler() print('Making request to the handler to get the students data') return jsonify( attendance_handler.GetStudentsAttendance(class_id, **request.args))
def get(self, student_id): if not student_id: return {"error": "Mandatory parameter class id not supplied"}, 400 attendance_handler = AttendanceHandler() print("making request to the handler to get the dashboard data") print(student_id) card4 = attendance_handler.DashboardDataCard4(student_id) return jsonify({"class_attendance": card4})
def post(self): # body: { # "attendance": [ # {"name": "Shivam Kapoor", "status": "P", "remarks": ""}, # {"name": "Tiwari Seth", "status": "A", "remarks": ""}, # ], # "date": "16-05-2020", # "updated_by": "" # } print(request.json) attendance_handler = AttendanceHandler() attendance_handler.PostTeacherAttendance(request.json)
def get(self): """ Gets a percenatge of present, absent and late students for the latest day. Param: Request: path: api/v0/attendance/daily body: {}, # Date format can be iso or "dd-m-YYYY" accept: application/json Response: return { percent: [{"Absent": "33.33", "Late": "16.66", "Present": "50"},], }, 200 content-type: application/json """ attendance_handler = AttendanceHandler() return jsonify(attendance_handler.GetStudentLatestDateAttendance())
def delete(self, class_id): """ Deletes students attendance given a date and class. Param: class_id: Class entity id. Request: path: api/v0/attendance/class body: { "date": "16-05-2020" } Response: None, 200 """ if not class_id: return {"error": "Mandatory parameter class id not supplied"}, 400 request_payload = request.json start_date = request_payload['start_date'] end_date = request_payload['end_date'] attendance_handler = AttendanceHandler() print('Making request to the handler to post the students data') attendance_handler.DeleteStudentsAttendance(class_id, start_date, end_date)
def get(self, emp_id): attendance_handler = AttendanceHandler() return jsonify( attendance_handler.GetTeacherAttendanceReportByName(emp_id))
def get(self): attendance_handler = AttendanceHandler() return jsonify(attendance_handler.GetTeacherAttendanceReport())
def get(self, class_id): if not class_id: return {"error": "mandatory parameter not supplied"}, 404 attendance_handler = AttendanceHandler() return jsonify(attendance_handler.TeacherDashboardLineGraph(class_id))
def get(self, teacher_name): attendance_handler = AttendanceHandler() return jsonify( attendance_handler.GetTeacherAttendanceByName(teacher_name))
def get(self): attendance_handler = AttendanceHandler() return jsonify( attendance_handler.GetTeacherLatestDateAttendanceDetails())
def get(self, student_name): attendance_handler = AttendanceHandler() return jsonify( attendance_handler.GetStudentAttendanceByName(student_name))
def get(self): attendance_handler = AttendanceHandler() return jsonify(attendance_handler.GetStudentsLowAttendance())