feat: add attendee detail and stats features
- Implemented API endpoints to fetch attendee details and statistics. - Created new route for fetching attendee by ID and their attendance stats. - Added schemas for attendee statistics. - Developed frontend components to display attendee details and attendance statistics. - Integrated attendee detail provider to manage state and data fetching. - Added tests for attendee retrieval and statistics calculation.
This commit is contained in:
@@ -12,7 +12,6 @@ const at = (offsetDays: number) => new Date(Date.now() - offsetDays * day);
|
||||
function entry(status: 'PRESENT' | 'ABSENT' | 'EXCUSED', offsetDays: number) {
|
||||
return { status, occurredAt: at(offsetDays) };
|
||||
}
|
||||
|
||||
describe('trailingAbsentStreak', () => {
|
||||
it('devuelve 0 sin registros', () => {
|
||||
expect(trailingAbsentStreak([])).toBe(0);
|
||||
@@ -34,13 +33,14 @@ describe('trailingAbsentStreak', () => {
|
||||
|
||||
describe('lastAttendedAt', () => {
|
||||
it('devuelve la clase PRESENT más reciente', () => {
|
||||
const now = Date.now();
|
||||
const result = lastAttendedAt([
|
||||
entry('PRESENT', 0),
|
||||
{ status: 'PRESENT', occurredAt: new Date(now) },
|
||||
entry('ABSENT', 7),
|
||||
entry('ABSENT', 14),
|
||||
]);
|
||||
expect(result).not.toBeNull();
|
||||
expect(result?.getTime()).toBe(at(0).getTime());
|
||||
expect(result?.getTime()).toBe(now);
|
||||
});
|
||||
|
||||
it('devuelve null si nunca asistió', () => {
|
||||
|
||||
Reference in New Issue
Block a user