docs: update documentation with recent features

- Add Recording Matching System section (auto-matching algorithm)
- Add Competitor Number (Bib) Support section
- Add Frontend Refactoring section (component extraction, constants)
- Update test count: 223 → 286 tests (73% coverage)
- Update dates to 2025-11-23
This commit is contained in:
Radosław Gierwiało
2025-11-23 23:05:23 +01:00
parent 6f7465ee5a
commit 93c5680397
2 changed files with 165 additions and 13 deletions

View File

@@ -809,7 +809,137 @@ Centralized dashboard for logged-in users to:
---
**Last Updated:** 2025-11-21 (Dashboard implementation completed)
## ✅ Competitor Number (Bib) Support (COMPLETED 2025-11-22)
**Status:** Completed
**Commits:** 1 commit
### Overview
Added competitor number (bib number) support for event participants, used by the auto-matching system to identify who is dancing (competitor) vs who can record.
### Implementation
- [x]**Database migration** `20251121210620_add_competitor_number`
- Added `competitorNumber` field to EventParticipant model
- Optional string field for bib/competitor number
- [x]**API updates**
- EventParticipant includes competitorNumber in responses
- Used by matching algorithm to identify dancers
- [x]**Frontend display**
- Competitor numbers shown in event UI
### Git Commits
1. `feat(events): add competitor number (bib) support`
---
## ✅ Recording Matching System (COMPLETED 2025-11-22)
**Status:** Completed
**Time Spent:** ~4 hours
**Commits:** 3 commits
### Overview
Auto-matching system that pairs dancers with recorders for video capture during competitions. The algorithm considers:
- Heat collision avoidance (can't record while dancing)
- Schedule config for division slot collision groups
- Buffer time (1 heat after dancing before can record)
- Location preference (same city > same country > anyone)
- Max recordings per person limit (3)
### Backend Implementation
- [x]**Matching service** `backend/src/services/matching.js`
- `runMatching(eventId)` - Main algorithm
- `buildDivisionSlotMap()` - Parse schedule config
- `getTimeSlot()` - Calculate slot identifier
- `getBufferSlots()` - Buffer after dancing
- `hasCollision()` - Check availability
- `getCoverableHeats()` - Find recordable heats
- `getLocationScore()` - Preference scoring
- `saveMatchingResults()` - Persist suggestions
- `getUserSuggestions()` - Get user's assignments
- [x]**RecordingSuggestion model**
- Links heat to suggested recorder
- Status: pending, accepted, rejected, not_found
- [x]**Schedule config** in Event model
- JSON field for slot configuration
- Divisions in same slot collide with each other
- [x]**API endpoints** in events.js
- `POST /api/events/:slug/matching/run` - Run matching algorithm
- `GET /api/events/:slug/matching/suggestions` - Get user suggestions
### Frontend Implementation
- [x]**RecordingTab component**
- "To Be Recorded" section (heats where user needs recorder)
- "To Record" section (heats where user records someone)
- Suggestion status indicators
- Accept/decline actions
### Constants
- [x]**SUGGESTION_STATUS** - pending, accepted, rejected, not_found
- [x]**SUGGESTION_TYPE** - toBeRecorded, toRecord
### Git Commits
1. `feat(matching): add auto-matching system for recording partners`
2. `feat(frontend): add recording matching UI`
3. `feat(matching): add schedule config for division collision groups`
---
## ✅ Frontend Refactoring (COMPLETED 2025-11-23)
**Status:** Completed
**Commits:** 6 commits
### Overview
Major refactoring of frontend code to extract reusable components and add status constants for better code quality.
### Component Extraction
- [x]**DashboardPage** extracted into:
- `DashboardHeader.jsx`
- `EventCard.jsx`
- `MatchCard.jsx`
- `MatchRequestCard.jsx`
- Barrel export: `components/dashboard/index.js`
- [x]**EventDetailsPage** extracted into components
- [x]**ProfilePage** extracted into:
- `ProfileForm.jsx` (192 lines)
- `PasswordChangeForm.jsx` (99 lines)
- Reduced ProfilePage from 394 → 84 lines (-79%)
- [x]**MatchesPage** extracted:
- `MatchCard.jsx` component
- Barrel export: `components/matches/index.js`
### Status Constants
- [x]**Frontend** `frontend/src/constants/statuses.js`
- `MATCH_STATUS` - pending, accepted, rejected, completed
- `SUGGESTION_STATUS` - pending, accepted, rejected, not_found
- `MATCH_FILTER` - all, pending, accepted
- `CONNECTION_STATE` - disconnected, connecting, connected, failed
- `SUGGESTION_TYPE` - toBeRecorded, toRecord
- [x]**Backend** `backend/src/constants/statuses.js`
- `MATCH_STATUS` - Same values as frontend
- `SUGGESTION_STATUS` - Same values as frontend
- [x] ✅ Updated all files to use constants instead of string literals
### Test Fixes
- [x]**users.test.js** - Added wsdcId cleanup for unique constraint
- [x]**auth-phase1.5.test.js** - Added wsdcId cleanup with related data deletion
- [x] ✅ All 286 backend tests passing
### Git Commits
1. `refactor(frontend): extract EventDetailsPage into components`
2. `refactor(frontend): extract DashboardPage into components`
3. `refactor(frontend): extract MatchCard component from MatchesPage`
4. `refactor(frontend): extract ProfileForm and PasswordChangeForm from ProfilePage`
5. `refactor(frontend): replace status string literals with constants`
6. `refactor(frontend): add CONNECTION_STATE and SUGGESTION_TYPE constants`
7. `refactor(backend): add status constants and update code to use them`
8. `fix(tests): add wsdcId cleanup to prevent unique constraint violations`
---
**Last Updated:** 2025-11-23 (Recording Matching + Frontend Refactoring completed)
**Note:** This file is an archive of completed phases. For current status, see SESSION_CONTEXT.md or TODO.md
**MVP Status:** ✅ 100% Complete - All core features implemented, tested, and production-ready
**Test Status:** 286/286 backend tests passing (73% coverage)