Skip to content

Conversation

@AlexVOiceover
Copy link
Contributor

Summary

  • Add aggregate query functions to attendance service for dashboard metrics
  • New functions: getApprenticeAttendanceStats, getCohortAttendanceStats, getAttendanceSummary
  • Add TypeScript types for attendance statistics and trends
  • Trend calculation compares last 4 weeks vs previous 4 weeks

Changes

  • src/lib/types/attendance.ts: Added AttendanceStats, AttendanceTrend, ApprenticeAttendanceStats, CohortAttendanceStats, AttendanceSummary types
  • src/lib/airtable/attendance.ts: Added aggregate functions with helper utilities
  • src/lib/airtable/attendance.spec.ts: Added tests for new functions

Test plan

  • All 54 tests pass
  • Lint passes
  • Functions handle empty data gracefully (returns null or zero values)

Closes AP-27

Add attendance statistics functions for the upcoming dashboard:
- getAllAttendance() - fetch all attendance records
- getAllEvents() - fetch all events with cohort associations
- getApprenticeAttendanceStats() - individual apprentice stats
- getCohortAttendanceStats() - cohort aggregate stats
- getAttendanceSummary() - overall summary for dashboard card

Includes TypeScript types for AttendanceStats, AttendanceTrend,
ApprenticeAttendanceStats, CohortAttendanceStats, AttendanceSummary.

Trend calculation compares last 4 weeks vs previous 4 weeks.
Low attendance threshold: 80%.

Closes AP-27
@AlexVOiceover AlexVOiceover merged commit 4b91cc0 into main Jan 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants