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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user