Attendance Recording & Tracking Methods
The Attendance module records member participation in church services, Sunday school classes, and events, powering engagement analysis and pastoral alerts.
1. Core Data Structure (attendance_records)
Each check-in creates or updates a record in public.attendance_records containing:
attendance_date(date): The day of the gathering (defaults to the current date).status(text): The member’s status:'present','late', or'absent'.check_in_time/check_out_time(timestamptz): Accurate check-in timestamps.source(text): Log of how the record was created:'manual','bulk_import','qr_scan', or'offline_sync'.recorded_by(uuid): References the user ID of the servant who checked the member in.
2. Recording Methods
Single Check-In
Servants select a member’s name from the event roster and click Check In. This creates an immediate database insert with source = 'manual'.
QR Code Scanning
Members present a profile QR code (generated in their self-service app) at a tablet kiosk. The scanning device triggers a quick check-in request setting source = 'qr_scan', instantly logging their attendance.
Bulk Import & Class Sheets
For Sunday school classes or large services, leaders can record attendance in bulk. This uses a dedicated Bulk Attendance Sheet in the UI.
3. Bulk Recording RPC (bulk_record_attendance)
To handle bulk submissions efficiently in a single database round-trip, Kononia uses the bulk_record_attendance RPC.
Execution Details
- Arguments:
p_org_id(uuid): Active organization.p_event_id(uuid): Event reference.p_session_id(uuid): Session reference.p_attendance_date(date): Target date.p_entries(jsonb): JSON array of records (each containingperson_id,status,notes,absence_reason).
- Processing Flow:
- Purge Old Entries: Deletes existing records matching the specific event, people, and date to prevent duplicates.
- Bulk Insert: Inserts all items from the JSON array in a single SQL operation, setting
source = 'bulk_import'. - Metric Updates: Calculates aggregated totals and updates the matching
attendance_sessionsrecord (incrementingtotal_presentandtotal_absent).