Refactor monster_catches from table to view and add overwrite option

- Convert monster_catches from table to view for automatic calculation
- Add overwrite checkbox to monster import UI
- Remove manual INSERT/UPDATE logic for catches (now handled by view)
- Simplify API endpoints to query view instead of managing state
- Add confirmation dialog for overwrite operation

Benefits:
- No data duplication
- Always accurate catch status based on current steps
- Simpler codebase with less state management
- Easier to reset steps without orphaned catch records

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-20 16:08:02 +02:00
parent 05e4a505b3
commit 04891bf449
4 changed files with 106 additions and 108 deletions

View File

@@ -106,6 +106,12 @@
<h3>Admin: Import Monsters</h3>
<p class="help-text">Upload CSV with columns: date, monster_name, monster_description, step_goal, monster_icon</p>
<input type="file" id="monster-csv-file" accept=".csv">
<div style="margin: 10px 0;">
<label style="display: flex; align-items: center; gap: 8px; cursor: pointer;">
<input type="checkbox" id="monster-overwrite" style="cursor: pointer;">
<span style="color: #ff7700;">Overwrite all existing monsters (deletes all current monsters and catches)</span>
</label>
</div>
<button id="import-monsters" class="btn-secondary">Import Monsters</button>
<div id="monster-import-message" class="message"></div>
</div>