File size: 5,892 Bytes
6aa6081
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Sprint Plan β€” Post-MVP Sprint (Friday 2026-05-29)

**Status:** πŸ“‹ PLANNED

**Goal:** Close remaining gaps blocking client demo β€” password reset, school calendar, section capacity, admin/obrero workflows, and basic documentation.

**Constraint:** 1 day β€” prioritize items a client would notice first in a demo.

---

## Sprint A β€” Client-Demo Blockers (Morning, ~4 hrs)

| ID | Priority | Description | Effort | Verification |
|----|----------|-------------|--------|-------------|
| F007a | **P0** | **Password reset flow** β€” Admin-generated reset token + forced password change on next login. No email dependency (schools often lack mail infra). Add "Reset Password" button on UsersPage, backend endpoint `POST /auth/reset-password/{user_id}` returning a one-time token, and a `ResetPasswordPage` where user enters new password. | ~2 hrs | Admin resets user password β†’ user logs in with token β†’ forced to set new password β†’ redirected to dashboard |
| F006a | **P0** | **Hide Sat/Sun in schedule grid** β€” Modify `ScheduleModal.tsx` `DAY_NAMES` to filter out SΓ‘bado/Domingo by default, add a "Mostrar fin de semana" toggle. No model changes needed. | ~30 min | Schedule modal shows only Mon-Fri; toggle shows all 7 days |
| F006b | **P1** | **Holiday calendar** β€” New `Holiday` model (`id`, `account_id`, `name`, `date`, `type` enum `national/school/vacation`). CRUD endpoints at `/settings/holidays`. Admin UI page to add/edit/delete holidays (`HolidaysPage.tsx` or embedded in Settings). Block attendance creation on holiday dates at the backend. | ~3 hrs | Admin creates holiday β†’ teacher cannot take attendance for that date (409 or warning) |

## Sprint B β€” UX Completeness (Afternoon, ~3 hrs)

| ID | Priority | Description | Effort | Verification |
|----|----------|-------------|--------|-------------|
| F006.1 | **P1** | **Section capacity enforcement** β€” Add `COUNT` query in `POST /enrollments` and `POST /enrollments/bulk` checking `Enrollment` count < `Section.max_students`. Return 409 with message "SecciΓ³n al mΓ‘ximo de capacidad (N estudiantes)" for single, skip+message for bulk. | ~1 hr | Enroll 40 students β†’ 41st returns 409; bulk skips over-capacity with error row |
| F007b | **P1** | **Audit log viewer** β€” Backend endpoint `GET /audit-logs` (paginated, filterable by user/action/date). Admin-only `AuditLogsPage.tsx` with table showing timestamp, user, action, resource, IP. Add to sidebar nav under ConfiguraciΓ³n. | ~1.5 hrs | Admin visits audit logs β†’ sees paginated list of actions with filters |
| F008 | **P2** | **Admin/obrero basic workflows** β€” `GET /reports/students` endpoint for administrativo (student list with attendance stats). Obrero gets access to PublicCheckInPage as primary view. Late arrival analytics: `GET /reports/late-arrivals?section_id=X&date_from=Y&date_to=Z` counting records with `RETRASO:` in note, grouped by student, with frequency + avg tardiness. | ~2.5 hrs | Admin role sees student reports link; Obrero sees check-in as default; late arrivals endpoint returns structured data |

---

## Sprint C β€” Quality & Maintainability (Flex, ~2 hrs)

| ID | Priority | Description | Effort | Verification |
|----|----------|-------------|--------|-------------|
| F009a | **P2** | **CHECKPOINTS.md + docs** β€” Write `CHECKPOINTS.md` with verification criteria matching all 9 features. Create `docs/architecture.md` documenting system layers, patterns, data flow. Create `docs/conventions.md` with naming, style, commit conventions. | ~1.5 hrs | All 3 files exist with meaningful content |
| F009b | **P2** | **Core business logic tests** β€” pytest fixtures with SQLite in-memory DB. Tests for: attendance present/absent counting, enrollment duplicate + capacity check, auth JWT validation, holiday attendance blocking. Aim for β‰₯20% coverage on `backend/app/api/` and `backend/app/models/`. | ~2 hrs | `pytest tests/ --cov=backend/app --cov-fail-under=20` passes |

---

## Execution Order (Recommended)

```
Morning (Sprint A):
  09:00-09:30  F006a β€” Hide Sat/Sun (quick win)
  09:30-11:30  F007a β€” Password reset (highest client demo value)
  11:30-12:30  F006b β€” Holiday calendar (model + backend)

Lunch

Afternoon (Sprint B):
  13:30-14:30  F006b β€” Holiday calendar UI + attendance blocking
  14:30-15:30  F006.1 β€” Section capacity enforcement
  15:30-17:00  F007b β€” Audit log viewer
  17:00-18:30  F008 β€” Admin/obrero workflows + late analytics

Flex (Sprint C, if time):
  18:30-19:30  F009a β€” CHECKPOINTS.md + docs
  19:30-21:00  F009b β€” Core business logic tests
```

---

## Dependencies

| Feature | Depends On | Risk |
|---------|-----------|------|
| F006b (holiday calendar) | New migration (018) | Low β€” standard CRUD |
| F006a (hide Sat/Sun) | None | None β€” pure frontend change |
| F006.1 (capacity) | F005 (already done β€” constraint fixed) | Low β€” simple COUNT query |
| F007a (password reset) | Auth system (already done) | Medium β€” token expiry design |
| F007b (audit log UI) | AuditLog model (already exists) | Low β€” paginated query |
| F008 (role workflows) | Permission system (already done) | Medium β€” route guard changes |
| F009a (docs) | None | None β€” writing only |
| F009b (tests) | Pytest fixtures | Medium β€” SQLite in-memory DB setup |

---

## Rollback Plan

If Sprint A exceeds time, defer F006b (holiday calendar UI polish) to Sprint B. If Sprint B overflows, defer F008 (late analytics) to flex. The **minimum viable for client demo** is: password reset (F007a) + hide Sat/Sun (F006a) + section capacity (F006.1).

---

## Pipeline

1. **Leader** dispatches each feature to an Implementer
2. **Implementer** builds code + tests + documents in `progress/current.md`
3. **Reviewer** validates via `./init.sh` + manual checks
4. **Advisor** confirms business logic is correct
5. **Leader** closes loop (log rotation + purge)