Membership-System und Bug Fixing (inkl. Nutrition) #8
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "develop"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase 3 Frontend - First Component: Matrix Editor New page: AdminTierLimitsPage - Displays Tier x Feature matrix (editable table) - Inline editing for all limit values - Visual feedback for changes (highlighted cells) - Batch save with validation - Category grouping (data, ai, export, integration) - Legend: ∞ = unlimited (NULL), ❌ = disabled (0), 1-999 = limit - Responsive table with sticky column headers Features: - GET /api/tier-limits - Load matrix - PUT /api/tier-limits/batch - Save all changes - Change tracking (shows unsaved count) - Reset button to discard changes - Success/error messages API helpers added (api.js): - v9c subscription endpoints (user + admin) - listFeatures, listTiers, getTierLimitsMatrix - updateTierLimit, updateTierLimitsBatch - listCoupons, redeemCoupon - User restrictions, access grants Navigation: - Link in AdminPanel (Settings Page) - Route: /admin/tier-limits Ready for testing on Dev! Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>User can now view: - Current tier (Free, Basic, Premium, Selfhosted) with icon - Trial status and end date - Access expiration date - Feature limits with usage bars - Progress indicators (green/orange/red based on usage) - Reset period info (daily/monthly/never) Coupon redemption: - Input field for coupon code - Auto-uppercase, monospace display - Enter key support - Success/error feedback - Auto-refresh after redemption Features: - Clean card-based layout - Visual tier badges with colors - Progress bars for count limits - Trial and access warnings - Integrated in Settings page Link added to SettingsPage: - "👑 Abo-Status, Limits & Coupon einlösen" - Easy access for all users Phase 3 complete - all user-facing subscription features done! Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>Critical bug fix: - Added missing "import { Link } from 'react-router-dom'" - Caused Settings page to crash on render - Route /settings now works again Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>⚠️ MAJOR GAP IDENTIFIED: Feature limits don't work! - Admin UI exists to configure limits - But actual enforcement (check_feature_access) is NOT called in endpoints - Users can exceed limits, use disabled features Backend TODO (CRITICAL): - Add feature checks to insights.py (AI analysis) - Add feature checks to exportdata.py, importdata.py - Add feature checks to nutrition.py, activity.py (imports) - Add feature checks to photos.py, data entry endpoints Frontend TODO (UX): - Implement useFeatureAccess() hook - Create <FeatureGate> component - Hide disabled features - Show limit counters & upgrade prompts Estimated work: 2-3 hours Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>Critical fixes for feature enforcement: - Add GET /api/features/{feature_id}/check-access endpoint (was missing!) - Add migration for missing features: data_export, csv_import - These features were used in frontend but didn't exist in DB This fixes: - "No analysis available" when setting KI limit - Export features not working - Frontend calling non-existent API endpoint Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>PHASE 2: Backend Non-Blocking Logging - KOMPLETT Instrumentierte Endpoints (12): - Data: weight, circumference, caliper, nutrition, activity, photos (6) - AI: insights/run/{slug}, insights/pipeline (2) - Export: csv, json, zip (3) - Import: zip (1) Pattern implementiert: - check_feature_access() VOR Operation (non-blocking) - [FEATURE-LIMIT] Logging wenn Limit überschritten - increment_feature_usage() NACH Operation - Alte Permission-Checks bleiben aktiv Features geprüft: - weight_entries, circumference_entries, caliper_entries - nutrition_entries, activity_entries, photos - ai_calls, ai_pipeline - data_export, data_import Monitoring: 1-2 Wochen Log-Only-Phase Logs zeigen: Wie oft würde blockiert werden? Nächste Phase: Frontend Display (Usage-Counter) Phase 1 (Cleanup) + Phase 2 (Logging) vollständig! Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>Implementiert User-freundliches Limit-Feedback für Daten-Einträge: - Button wird deaktiviert wenn Limit erreicht - Hover-Tooltip erklärt warum ("Limit erreicht X/Y") - Button-Text zeigt "🔒 Limit erreicht" - Error-Handling für alle API-Fehler - Usage-Badge wird nach Speichern aktualisiert Betrifft: Weight, Circumference, Caliper Screens Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>Alle verbleibenden Screens mit proaktiver Limit-Anzeige: - ActivityPage: Manuelle Einträge mit Badge + deaktiviertem Button - Analysis: AI-Analysen (Pipeline + Einzelanalysen) mit Hover-Tooltip - NutritionPage: Hat bereits Error-Handling (bulk import) Konsistentes Pattern: - Usage-Badge im Titel - Button deaktiviert + Hover-Tooltip bei Limit - "🔒 Limit erreicht" Button-Text - Error-Handling für API-Fehler - Usage reload nach erfolgreichem Speichern Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>Feature-Enforcement komplett: - ✅ Phase 1-4 alle abgeschlossen - 11 Features mit Monitoring, UI-Badges + Blocking - Verweis auf neue FEATURE_ENFORCEMENT.md Dokumentation Lokale Dokumentation erstellt: - .claude/docs/architecture/FEATURE_ENFORCEMENT.md - Vollständiger Guide für neue Feature-Integration - Backend + Frontend Pattern mit Beispielen - Checkliste + Debugging-Tipps Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>Problem: - /api/nutrition/weekly crashed with 500 Internal Server Error - TypeError: strptime() argument 1 must be str, not datetime.date Root Cause: - d['date'] from PostgreSQL is already datetime.date object - datetime.strptime() expects string input - Line 156: wk=datetime.strptime(d['date'],'%Y-%m-%d').strftime('%Y-W%V') Solution: - Added type check before strptime() - If date already has strftime method → use directly - Else → parse as string first - Works with both datetime.date objects and strings Tested: - /nutrition page loads without error - Weekly aggregation works correctly - Chart displays nutrition data Closes: BUG-001 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>Features: - Import history panel showing all CSV imports with date, count, and range - Edit/delete functionality for nutrition entries (inline editing) - New backend endpoints: GET /import-history, PUT /{id}, DELETE /{id} UI Changes: - Import history displayed under import panel - "Daten" tab now has edit/delete buttons per entry - Inline form for editing macros (kcal, protein, fat, carbs) - Confirmation dialog for deletion Backend: - nutrition.py: Added import_history, update_nutrition, delete_nutrition endpoints - Groups imports by created date to show history Frontend: - NutritionPage: New DataTab and ImportHistory components - api.js: Added nutritionImportHistory, updateNutrition, deleteNutrition Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>Features: - Manual entry form above data list - Date picker with auto-load existing entries - Upsert logic: creates new or updates existing entry - Smart button text: "Hinzufügen" vs "Aktualisieren" - Prevents duplicate entries per day - Feature enforcement for nutrition_entries Backend: - POST /nutrition - Create or update entry (upsert) - GET /nutrition/by-date/{date} - Load entry by date - Auto-detects existing entry and switches to UPDATE mode - Increments usage counter only on INSERT Frontend: - EntryForm component with date picker + macros inputs - Auto-loads data when date changes - Shows info message when entry exists - Success/error feedback - Disabled state while loading/saving Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>