Added Roll Number to Student Batch Attendance Tool and Optimised code to mark attendance
diff --git a/erpnext/schools/api.py b/erpnext/schools/api.py
index dea8515..7cb02a3 100644
--- a/erpnext/schools/api.py
+++ b/erpnext/schools/api.py
@@ -54,13 +54,13 @@
 	"""
 	present = json.loads(students_present)
 	absent = json.loads(students_absent)
-
 	for d in present:
 		make_attendance_records(d["student"], d["student_name"], "Present", course_schedule, student_batch, date)
 
 	for d in absent:
 		make_attendance_records(d["student"], d["student_name"], "Absent", course_schedule, student_batch, date)
 
+	frappe.db.commit()
 	frappe.msgprint(_("Attendance has been marked successfully."))
 
 def make_attendance_records(student, student_name, status, course_schedule=None, student_batch=None, date=None):
@@ -79,7 +79,6 @@
 	student_attendance.date = date
 	student_attendance.status = status
 	student_attendance.submit()
-	frappe.db.commit()
 
 @frappe.whitelist()
 def get_student_batch_students(student_batch):
@@ -87,7 +86,7 @@
 
 	:param student_batch: Student Batch.
 	"""
-	students = frappe.get_list("Student Batch Student", fields=["student", "student_name"] , filters={"parent": student_batch}, order_by= "idx")
+	students = frappe.get_list("Student Batch Student", fields=["student", "student_name", "idx"] , filters={"parent": student_batch}, order_by= "idx")
 	return students
 
 @frappe.whitelist()
diff --git a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.js b/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.js
index 6dc9181..2dc6a85 100644
--- a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.js
+++ b/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.js
@@ -88,16 +88,23 @@
                 });
             });
 
+        var get_student = function(idx) {
+            return students.filter(function(s) {
+                return s.idx === idx;
+            })[0]
+        }
+
         student_toolbar.find(".btn-mark-att")
             .html(__('Mark Attendence'))
             .on("click", function() {
                 var students_present = [];
                 var students_absent = [];
                 $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
+                    var idx = $(check).data().idx;
                     if ($(check).is(":checked")) {
-                        students_present.push(students[i]);
+                        students_present.push(get_student(idx));
                     } else {
-                        students_absent.push(students[i]);
+                        students_absent.push(get_student(idx));
                     }
                 });
                 frappe.call({
@@ -118,9 +125,12 @@
         $.each(students, function(i, m) {
             $(repl('<div class="col-sm-6">\
 				<div class="checkbox">\
-				<label><input type="checkbox" class="students-check" student="%(student)s">\
-				%(student)s</label>\
-			</div></div>', { student: m.student_name })).appendTo(me.wrapper);
+				<label><input data-idx="%(idx)s" type="checkbox" class="students-check" data-student="%(name)s">\
+				%(idx)s - %(name)s</label>\
+			</div></div>', {
+                name: m.student_name,
+                idx: m.idx
+            })).appendTo(me.wrapper);
         });
     }
 });
\ No newline at end of file
diff --git a/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py
index 8c6006e..2f8ba52 100644
--- a/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py
+++ b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py
@@ -31,7 +31,7 @@
 				total_p += 1
 			elif status == "Absent":
 				total_a += 1
-		
+
 		row += [total_p, total_a]
 		data.append(row)