Merge pull request #9641 from manassolanki/att-report
show inactive students in the monthly attendance report
This commit is contained in:
commit
3638250f5d
@ -114,11 +114,15 @@ def get_student_guardians(student):
|
||||
return guardians
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_student_group_students(student_group):
|
||||
def get_student_group_students(student_group, include_inactive=0):
|
||||
"""Returns List of student, student_name in Student Group.
|
||||
|
||||
:param student_group: Student Group.
|
||||
"""
|
||||
if include_inactive:
|
||||
students = frappe.get_list("Student Group Student", fields=["student", "student_name"] ,
|
||||
filters={"parent": student_group}, order_by= "group_roll_number")
|
||||
else:
|
||||
students = frappe.get_list("Student Group Student", fields=["student", "student_name"] ,
|
||||
filters={"parent": student_group, "active": 1}, order_by= "group_roll_number")
|
||||
return students
|
||||
|
@ -15,19 +15,24 @@ def execute(filters=None):
|
||||
to_date = get_last_day(filters["month"] + '-' + filters["year"])
|
||||
total_days_in_month = date_diff(to_date, from_date) +1
|
||||
columns = get_columns(total_days_in_month)
|
||||
students = get_student_group_students(filters.get("student_group"))
|
||||
students = get_student_group_students(filters.get("student_group"),1)
|
||||
students_list = get_students_list(students)
|
||||
att_map = get_attendance_list(from_date, to_date, filters.get("student_group"), students_list)
|
||||
data = []
|
||||
for stud in students:
|
||||
row = [stud.student, stud.student_name]
|
||||
student_status = frappe.db.get_value("Student", stud.student, "enabled")
|
||||
date = from_date
|
||||
total_p = total_a = 0.0
|
||||
for day in range(total_days_in_month):
|
||||
status="None"
|
||||
if att_map.get(stud.student):
|
||||
status = att_map.get(stud.student).get(date, "None")
|
||||
status_map = {"Present": "P", "Absent": "A", "None": ""}
|
||||
elif not student_status:
|
||||
status = "Inactive"
|
||||
else:
|
||||
status = "None"
|
||||
status_map = {"Present": "P", "Absent": "A", "None": "", "Inactive":"-"}
|
||||
row.append(status_map[status])
|
||||
if status == "Present":
|
||||
total_p += 1
|
||||
|
Loading…
Reference in New Issue
Block a user