Hi!
I would like to generate an attendance report for each student that reflects their attendance on a per-lesson basis.
Students are required to attend at least 90% of all lessons in order for their course to be validated. Therefore, I am looking for a way to:
-
Calculate the overall attendance percentage based on all lessons delivered during a semester (with attendance recorded for each individual lesson).
-
Calculate the overall attendance percentage for each subject within a semester, based on the total number of lessons for that subject.
So far, I have only been able to generate attendance reports by day. This means that if a student attends just one lesson in a given day, they are marked as having 100% attendance for that day, even if they were absent from other lessons scheduled on the same day.
Maybe I am missing some config for this?
Cheers,
Hi, @AerofixGibbon
This is something my teachers have asked for quite often, and it’s a pretty quick solution using the query builder! The query builder is great for any data analysis you might want to do that isn’t already displayed.
This is a sample script you might find useful, which takes a single course and term then shows the absence percentages. If you want to make a more robust report you will need to modify the sql query parameters.
SELECT
CONCAT(p.surname, ', ', p.preferredName) AS Student,
CONCAT(c.nameShort, '.', cc.nameShort) AS Class,
COUNT(*) AS TotalSessions,
SUM(CASE WHEN ac.name = 'Present' THEN 1 ELSE 0 END) AS PresentSessions,
SUM(CASE WHEN ac.name <> 'Present' THEN 1 ELSE 0 END) AS Absences,
ROUND(SUM(CASE WHEN ac.name <> 'Present' THEN 1 ELSE 0 END) / COUNT(*) * 100, 2) AS AbsencePercent
FROM gibbonAttendanceLogPerson al
JOIN gibbonAttendanceCode ac ON al.gibbonAttendanceCodeID = ac.gibbonAttendanceCodeID
JOIN gibbonCourseClass cc ON al.gibbonCourseClassID = cc.gibbonCourseClassID
JOIN gibbonCourse c ON cc.gibbonCourseID = c.gibbonCourseID
JOIN gibbonPerson p ON al.gibbonPersonID = p.gibbonPersonID
JOIN gibbonSchoolYearTerm t ON al.date BETWEEN t.firstDay AND t.lastDay
WHERE
CONCAT(c.nameShort, '.', cc.nameShort) = :classCode
AND cc.reportable = 'Y'
AND t.gibbonSchoolYearTermID = :termID
GROUP BY Student, Class
ORDER BY p.surname, p.preferredName;