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:
@@ -668,16 +668,23 @@ window.addEventListener('DOMContentLoaded', async function () {
|
||||
bonPicksHeader.style.display = showBonPicksColumn ? '' : 'none';
|
||||
}
|
||||
|
||||
// Sort by total points (descending), then by watched ratio
|
||||
// Sort by total points (descending)
|
||||
stats.sort((a, b) => {
|
||||
const pointsDiff = (b.totalPoints || 0) - (a.totalPoints || 0);
|
||||
if (pointsDiff !== 0) return pointsDiff;
|
||||
return parseFloat(b.watchedRatio) - parseFloat(a.watchedRatio);
|
||||
return (b.totalPoints || 0) - (a.totalPoints || 0);
|
||||
});
|
||||
|
||||
// Clear previous rows to prevent duplication
|
||||
userTableBody.innerHTML = '';
|
||||
|
||||
// Get total movies count (same for all users in the same year)
|
||||
const totalMovies = stats.length > 0 ? (stats[0].totalMoviesCount || 0) : 0;
|
||||
|
||||
// Update Films column header with total
|
||||
const filmsHeader = document.getElementById('films-header');
|
||||
if (filmsHeader && totalMovies > 0) {
|
||||
filmsHeader.innerHTML = `Films <small class="text-muted" style="font-weight: normal;">(${totalMovies})</small>`;
|
||||
}
|
||||
|
||||
stats.forEach((userStat, index) => {
|
||||
const userRow = document.createElement('tr');
|
||||
const rank = index + 1;
|
||||
@@ -712,15 +719,11 @@ window.addEventListener('DOMContentLoaded', async function () {
|
||||
pointsTd.className = 'text-center';
|
||||
pointsTd.innerHTML = `<strong class="text-success">${userStat.totalPoints || 0}</strong>`;
|
||||
|
||||
const ratioTd = document.createElement('td');
|
||||
ratioTd.textContent = String(userStat.watchedRatio ?? '');
|
||||
|
||||
userRow.appendChild(rankTd);
|
||||
userRow.appendChild(nameTd);
|
||||
userRow.appendChild(countTd);
|
||||
userRow.appendChild(picksTd);
|
||||
userRow.appendChild(pointsTd);
|
||||
userRow.appendChild(ratioTd);
|
||||
userTableBody.appendChild(userRow);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user