feat: una sola regla de riesgo y preinscripciones pendientes en Inicio
- Estadísticas ("Alumnos en riesgo") y el job de reenganche usan la misma
regla de dominio que la lista de grupos e Inicio
(summarizeMemberAttendance). El armado del historial por alumno vive en
analytics/lib/member-attendance.ts y se borra el clasificador viejo
(racha o asistencia mensual < 50%).
- El badge de alumnos en riesgo muestra el motivo real (faltas seguidas,
días sin venir o asistencia en baja).
- GET /home devuelve pendingPreRegistrations por grupo (en la misma
consulta de grupos) y "Para atender" las lista con link a la ficha en
la pestaña Pendientes (?section=pending).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -273,20 +273,26 @@ describe('payment reminders', () => {
|
||||
describe('re-engagement messages', () => {
|
||||
function atRiskGroup() {
|
||||
// Two sessions in the window, both missed by att-1: a streak of 2 (MEDIUM).
|
||||
db.classSession.findMany.mockResolvedValue([{ id: 's1' }, { id: 's2' }]);
|
||||
const s1 = new Date('2026-10-16T10:00:00Z');
|
||||
const s2 = new Date('2026-10-14T10:00:00Z');
|
||||
const enrolled = new Date('2026-09-01T10:00:00Z');
|
||||
db.classSession.findMany.mockResolvedValue([
|
||||
{ id: 's1', startsAt: s1 },
|
||||
{ id: 's2', startsAt: s2 },
|
||||
]);
|
||||
db.attendee.findMany
|
||||
.mockResolvedValueOnce([
|
||||
{ id: 'att-1', fullName: 'Ana López', phone: '1123456789' },
|
||||
{ id: 'att-2', fullName: 'Beto', phone: '1198765432' },
|
||||
{ id: 'att-1', fullName: 'Ana López', phone: '1123456789', createdAt: enrolled },
|
||||
{ id: 'att-2', fullName: 'Beto', phone: '1198765432', createdAt: enrolled },
|
||||
])
|
||||
.mockResolvedValueOnce([
|
||||
{ id: 'att-1', phone: '1123456789', guardianPhone: null },
|
||||
]);
|
||||
db.attendance.findMany.mockResolvedValue([
|
||||
{ attendeeId: 'att-1', status: 'ABSENT', classSession: { startsAt: new Date('2026-10-16T10:00:00Z') } },
|
||||
{ attendeeId: 'att-1', status: 'ABSENT', classSession: { startsAt: new Date('2026-10-14T10:00:00Z') } },
|
||||
{ attendeeId: 'att-2', status: 'PRESENT', classSession: { startsAt: new Date('2026-10-16T10:00:00Z') } },
|
||||
{ attendeeId: 'att-2', status: 'PRESENT', classSession: { startsAt: new Date('2026-10-14T10:00:00Z') } },
|
||||
{ attendeeId: 'att-1', classSessionId: 's1', status: 'ABSENT', classSession: { startsAt: s1 } },
|
||||
{ attendeeId: 'att-1', classSessionId: 's2', status: 'ABSENT', classSession: { startsAt: s2 } },
|
||||
{ attendeeId: 'att-2', classSessionId: 's1', status: 'PRESENT', classSession: { startsAt: s1 } },
|
||||
{ attendeeId: 'att-2', classSessionId: 's2', status: 'PRESENT', classSession: { startsAt: s2 } },
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user