mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-03 18:22:57 +00:00
2.9 KiB
2.9 KiB
Quick Fix Guide - PPTX Files Showing 0 Usage
Problem Summary
Your PPTX file 20251016-153526-9c6b119b0ea8b3b0fca205fb5e80cfbb.pptx shows 0 usage even though it's being used in an event attachment.
Why This Happened
The file tracking system wasn't tracking event attachments - only the main image_url and file_url fields. The attachments array was being ignored.
Immediate Solution
Step 1: Rebuild & Restart Backend
# In your project root directory
cd c:\Users\conta\Downloads\PROG+HTML\Fotbal\fotbal-club
# Rebuild the Go backend
go build -o bin/fotbal-club.exe
# Restart the backend server
# Stop the current server (Ctrl+C if running)
# Then start it again
.\bin\fotbal-club.exe
Step 2: Rebuild Frontend (if needed)
cd frontend
npm run build
Step 3: Use the New Refresh Button
- Log in to your admin panel
- Go to Správa souborů (Files Management)
- Click the green "Aktualizovat sledování" button
- Wait for completion - you'll see a modal with statistics
- Close the modal and check your files list
- The PPTX file should now show usage count > 0
What Was Fixed
Backend Fixes
- Event attachment tracking - Now properly scans all attachments in events
- Article attachment tracking - Fixed bug where only one attachment was tracked
- New admin endpoint -
/api/v1/admin/files/refresh-trackingto re-scan everything - Better MIME detection - Added PPTX, DOCX, XLSX, and many other file types
Frontend Fixes
- New refresh button - Green "Aktualizovat sledování" button
- Result modal - Shows statistics after refresh
- Better UX - Two separate buttons: Scan files vs Refresh tracking
Verification
After running the refresh, verify the fix:
- Go to Files Management
- Search for your PPTX file:
20251016-153526-9c6b119b0ea8b3b0fca205fb5e80cfbb.pptx - Check the "Použití" (Usage) column - should now show 1 or more
- Click on the usage count to see where it's being used
- Should show the event details
Future Prevention
The fix is now permanent. All new events/articles with attachments will be automatically tracked correctly. You only need to use the "Refresh" button if:
- You have old data from before this fix
- You manually edit the database
- You suspect tracking data is out of sync
Troubleshooting
If the usage still shows 0:
- Check if the event still exists and has the attachment
- Verify the attachment URL matches the file URL exactly
- Check server logs for any errors during refresh
- Try refreshing just events: Add
?entity_type=eventto the API call
If you get errors:
- Check that the backend compiled successfully (no Go errors)
- Verify the database migrations ran (the file_usages table exists)
- Check that you're logged in as admin
- Look at browser console for API errors
Technical Details
See FILE_TRACKING_ENHANCEMENT.md for complete technical documentation.