@frappe.whitelist()
def mark_attendance(students_present, students_absent, course_schedule=None, student_batch=None, date=None):
 present = json.loads(students_present)
 absent = json.loads(students_absent)
 for d in present:
  make_attendance_records(d[u'student'], d[u'student_name'], u'Present', course_schedule, student_batch, date)
 for d in absent:
  make_attendance_records(d[u'student'], d[u'student_name'], u'Absent', course_schedule, student_batch, date)
 frappe.db.commit()
 frappe.msgprint(_(u'Attendance has been marked successfully.'))

@ frappe . whitelist ( ) def mark_attendance ( students_present , students_absent , course_schedule = None , student_batch = None , date = None ) : present = json . loads ( students_present ) absent = json . loads ( students_absent ) for d in present : make_attendance_records ( d [ u'student' ] , d [ u'student_name' ] , u'Present' , course_schedule , student_batch , date ) for d in absent : make_attendance_records ( d [ u'student' ] , d [ u'student_name' ] , u'Absent' , course_schedule , student_batch , date ) frappe . db . commit ( ) frappe . msgprint ( _ ( u'Attendance has been marked successfully.' ) )
creates multiple attendance records .