feat(api): add timezone support for group fetching and increase page size

feat(attendance): refactor attendance summary logic and update tests

feat(analytics): extend GroupRiskSummary schema with absence and attendance counts

feat(groups): enhance group schema with attendee and waitlist counts

chore(skills): add frontend design skill with guidelines and license

feat(attendee-detail): implement AttendeePhoneLine component for phone display

feat(groups): create AttendanceBadge and CapacityIndicator components for group cards

feat(groups): add card utility functions for attendance alerts and capacity summaries

test(groups): implement tests for attendance alert and capacity summary logic
This commit is contained in:
Jose Selesan
2026-09-30 17:39:13 -03:00
parent 4e86096653
commit 454f20ed25
31 changed files with 1323 additions and 250 deletions

View File

@@ -5,6 +5,12 @@ export type AttendanceStreamEntry = {
export type RiskLevel = 'HIGH' | 'MEDIUM';
/** Racha mínima de faltas sin justificar que ya dispara riesgo. */
export const MIN_RISK_ABSENCE_STREAK = 2;
/** Asistencia mensual (ventana de 30 días) por debajo de la cual hay riesgo. */
export const MIN_RISK_MONTHLY_RATE = 50;
// Cuenta las ausencias consecutivas sin justificar desde la clase más reciente.
// Recibe la lista ordenada de más reciente a más antigua; PRESENT y EXCUSED rompen la cadena.
export function trailingAbsentStreak(entries: AttendanceStreamEntry[]): number {
@@ -46,10 +52,10 @@ export function classifyRisk(
consecutiveAbsences: number,
monthlyRate: number,
): RiskLevel | null {
if (consecutiveAbsences >= 3) {
if (consecutiveAbsences >= MIN_RISK_ABSENCE_STREAK + 1) {
return 'HIGH';
}
if (consecutiveAbsences === 2 || monthlyRate < 50) {
if (consecutiveAbsences >= MIN_RISK_ABSENCE_STREAK || monthlyRate < MIN_RISK_MONTHLY_RATE) {
return 'MEDIUM';
}
return null;