Fix category management and remove import feature

- Fix category editing: Added GET /api/categories/:categoryId endpoint to fetch single category by ID, fixing 'Category not found' error when editing categories for active year
- Fix picks handling: Filter out picks for deleted categories when submitting, loading, and calculating scores to prevent errors
- Fix scores display: Always calculate scores from pickDetails instead of stored score value to ensure accuracy when categories are removed
- Add picks cleanup: Automatically clean up picks for deleted categories in database when categories are deleted or scores are fetched
- Fix winner clearing: Allow clearing winners by accepting empty/null winnerName in PUT /api/categories/:categoryId/winner
- Enable category number editing: Made category number editable in edit modal with validation and conflict checking; automatically updates all related picks when category number changes
- Add bulk category management: Added bulk select and delete functionality in Liste tab with select all checkbox and bulk delete button
- Remove import feature: Completely removed PDF/image import functionality including OCR, file upload, and all related UI components
- Update dependencies: Removed unused packages (tesseract.js, sharp, pdfjs-dist, canvas) after removing import feature
- Improve file cleanup: Added retry logic for file deletion to handle Windows file locking issues
This commit is contained in:
Mathieu Moran
2025-12-28 00:48:48 -05:00
parent 7d8077774b
commit 6a2ec537e9
12 changed files with 477 additions and 556 deletions
-7
View File
@@ -168,15 +168,9 @@
</div>
<div class="d-flex gap-2">
<button type="button" id="load-my-picks" class="btn btn-sm btn-outline-secondary">Recharger</button>
<button type="button" id="submit-picks" class="btn btn-sm btn-primary">Enregistrer</button>
</div>
</div>
<div id="unsaved-changes-banner" class="alert alert-warning alert-dismissible fade d-none" role="alert">
<strong>⚠️ Modifications en attente:</strong> Vous avez des modifications non enregistrées. N'oubliez pas d'enregistrer vos choix avant de quitter cette page.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<div id="categories-container">
<div class="text-center py-3 text-muted small">Chargement des catégories…</div>
</div>
@@ -206,7 +200,6 @@
<span class="text-muted small ms-2"><span id="winners-progress">0 / 0</span> gagnants marqués</span>
</div>
<div class="d-flex gap-2">
<button type="button" id="calculate-scores" class="btn btn-sm btn-success">Calculer</button>
<button type="button" id="refresh-winners" class="btn btn-sm btn-outline-secondary">Rafraîchir</button>
</div>
</div>