Commit Graph

84 Commits

Author SHA1 Message Date
a02df32ce2 fix: set created_by automatically on MediaWiki import
Some checks failed
Deploy Development / deploy (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m58s
- Added imported_by parameter to _run_import and _upsert_exercise
- Exercises now automatically get created_by set to importing user
- Fixes visibility issue where imported exercises were invisible

Related: Wiki import - exercise visibility fix
2026-04-27 09:52:18 +02:00
e6ce7e241c fix: convert skill target_level to INTEGER instead of string
Some checks failed
Deploy Development / deploy (push) Successful in 54s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m55s
- build_skill_assignments() now returns INTEGER (1-5) for target_level
- Previously returned string names ('einsteiger', 'grundlagen', etc.)
- Caused 91/95 import failures with 'invalid input syntax for type integer'
- Remaining 4 failures are wiki pages missing both goal AND execution (invalid data)

Issue: Wiki import - dict-cursor fixes phase 2
2026-04-27 09:30:29 +02:00
97a7fe7cba fix: reimport dict-cursor bug + add admin cleanup endpoint
Some checks failed
Deploy Development / deploy (push) Successful in 54s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m55s
Problem 1: Reimport fails completely (all exercises fail)
Root cause: Line 465 existing[0] instead of existing['id']
Fix: Changed to existing['id'] for dict-cursor compatibility

Problem 2: 221 exercises skipped, only 2 in database
Root cause: Orphaned wiki_import_references from failed imports
Fix: New admin endpoint to manually cleanup orphaned references

New endpoints:
- DELETE /api/import/mediawiki/admin/cleanup-orphaned-references
  Deletes all references where local_id doesn't exist in target table
  Returns count of deleted references per type

- GET /api/import/mediawiki/admin/stats
  Shows references vs. actual count + orphaned count
  Helps diagnose import state issues

Usage:
1. Call cleanup endpoint to remove orphaned references
2. Run normal import (reimport=false)
3. Should import all previously failed exercises
2026-04-27 08:52:05 +02:00
3a4160fd1c fix: detect and cleanup orphaned import references
Some checks failed
Deploy Development / deploy (push) Successful in 38s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m54s
Problem: 221 exercises skipped, but only 2 actually in database
Root cause: Failed imports created wiki_import_references entries,
but exercises were never saved (due to earlier bugs)

Duplicate check only verified references existed, not actual data.
Result: All subsequent imports skipped 'already imported' items.

Solution:
- Enhanced duplicate check to verify BOTH reference AND actual entity
- If reference exists but entity is missing → delete orphaned reference
- Item will be re-imported on same run (no manual cleanup needed)

Check logic:
1. Find reference in wiki_import_references
2. Check if exercises/skills/methods table has matching local_id
3. If both exist → skip (true duplicate)
4. If reference exists but entity missing → delete reference + re-import

This auto-heals broken state from previous failed imports.
2026-04-27 08:45:27 +02:00
1a0708f152 fix: correct remaining dict cursor access (row[0] → row['id'])
Some checks failed
Deploy Development / deploy (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 1m57s
Error: 100 exercises failed with error '0' (TypeError suppressed)
Root cause: More row[0] dict access in catalog assignment functions

Previous fix only covered fetchone()[0] in RETURNING clauses.
Missed 6 more locations in SELECT queries where row is dict-like.

Fixed locations:
- Line 511: focus_area_id in exercise_focus_areas INSERT
- Line 524: style_direction_id in exercise_training_styles INSERT
- Line 535: target_group_id in exercise_target_groups INSERT
- Line 546: skill_id in exercise_skills INSERT
- Line 568: skill_id in exercise_skills INSERT (with levels)
- Line 589: category_id assignment in _upsert_skill

All changed from row[0] to row['id'] for RealDictCursor compatibility.

This should fix the remaining 100 import failures.
2026-04-27 08:24:35 +02:00
bcc7d61d07 fix: make exercise goal and execution optional (at least one required)
Some checks failed
Deploy Development / deploy (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m54s
Error: 224/225 exercises failed with NOT NULL constraint violations
Root cause: exercises table requires BOTH goal AND execution (NOT NULL)
Reality: Many wiki exercises have only ONE of these fields

Migration 019:
- ALTER COLUMN goal DROP NOT NULL
- ALTER COLUMN execution DROP NOT NULL
- ADD CHECK constraint: (goal IS NOT NULL OR execution IS NOT NULL)

This allows:
✓ Exercises with only goal
✓ Exercises with only execution
✓ Exercises with both
✗ Exercises with neither (CHECK constraint fails)

Import validation already correct (line 312):
required_ok = bool(mapped.get('goal') or mapped.get('execution'))

DB schema was blocking valid exercises.
2026-04-24 20:42:21 +02:00
a37400bb22 fix: correct dict cursor access in MediaWiki import
Some checks failed
Deploy Development / deploy (push) Successful in 34s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 2m2s
Error: 500 Internal Server Error on execute import
Root cause: Using fetchone()[0] with RealDictCursor (dict-like rows)

PostgreSQL RealDictCursor returns dict-like objects, not tuples.
Accessing [0] on a dict throws TypeError.

Fix: Changed all fetchone()[0] to fetchone()['id']
Locations:
- Line 163: log_id after INSERT INTO wiki_import_log
- Line 485: ex_id after INSERT INTO exercises
- Line 599: skill_id after INSERT INTO skills
- Line 616: method_id after INSERT INTO training_methods

This matches the pattern used in other routers (exercises.py, etc.)
2026-04-24 20:37:31 +02:00
8b51864b53 feat: add recursive subcategory search for MediaWiki import
Some checks failed
Deploy Development / deploy (push) Successful in 34s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 2m2s
Issue: Only 2 exercises found instead of 200+
Root cause: Exercises likely organized in subcategories

Solution:
- Added recursive parameter to get_category_members()
- New _get_subcategories() helper method
- Recursively traverses all subcategories
- Logs subcategory counts for debugging

Behavior:
- get_category_members('Übungen') now finds:
  1. All pages directly in 'Kategorie:Übungen'
  2. All subcategories (e.g. 'Kihon', 'Kata', 'Kumite')
  3. All pages in those subcategories (recursive)

Example structure:
Kategorie:Übungen
├─ Seite: Übung A (2 direkte)
├─ Kategorie:Kihon
│  ├─ Seite: Mae-Geri
│  └─ Seite: Gyaku-Zuki
└─ Kategorie:Kata
   └─ Seite: Heian Shodan
2026-04-24 17:53:11 +02:00
9d041aaf4f fix: add MediaWiki credentials to docker-compose
Some checks failed
Deploy Development / deploy (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m55s
Error: MediaWiki Login fehlgeschlagen: The supplied credentials could not be authenticated
Root cause: MEDIAWIKI_USER and MEDIAWIKI_PASSWORD were empty in container

Fix:
- Set MEDIAWIKI_USER: Jinkendo
- Set MEDIAWIKI_PASSWORD: Jinkendo6970
- karatetrainer.net requires authentication for API access

Note: Credentials are for read-only access to public training wiki
Local .env file also updated (not committed, in .gitignore)
2026-04-24 17:42:28 +02:00
f54d8b2e03 fix: add MediaWiki environment variables to docker-compose
Some checks failed
Deploy Development / deploy (push) Successful in 33s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m54s
Error: 500 Internal Server Error on MediaWiki import
Root cause: MEDIAWIKI_API_URL not configured in container

Fix:
- Added MEDIAWIKI_API_URL: https://karatetrainer.net/api.php
- Added MEDIAWIKI_USER, MEDIAWIKI_PASSWORD (optional, uses .env)
- Added category name overrides (4 categories)

Public wiki access (read-only) does not require authentication.
User/password only needed for write operations.

Note: .env file created locally but not committed (in .gitignore)
Users should copy .env.example and set their credentials if needed.
2026-04-24 17:18:47 +02:00
c738f1234b fix: MediaWiki import - increase limit to 500 and add validation
Some checks failed
Deploy Development / deploy (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 1m54s
Error: 422 Unprocessable Entity when limit > 100
Root cause: Backend enforced max=100, frontend allowed any value

Backend fix:
- Increased preview limit from 100 to 500 (consistent with execute)
- import_wiki.py line 64: le=100 → le=500

Frontend fix:
- Added Math.min/max validation to both limit inputs
- Preview limit: max 500 with auto-clamp
- Execute limit: max 500 with auto-clamp
- Updated placeholder: 'Kein Limit (max 500)'

Prevents 422 errors from invalid limit values
2026-04-24 17:15:17 +02:00
89055ddbc4 feat: Admin page navigation with MediaWiki Import link
Some checks failed
Deploy Development / deploy (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m55s
- New AdminPageNav component with horizontal navigation
- Links to Hierarchie / Kataloge / Wiki-Import
- Integrated in all 3 admin pages
- Uses lucide-react icons (TreePine, FolderTree, Download)
- Active state tracking via useLocation
- Mobile-friendly with flexbox layout

Navigation flow:
/admin/hierarchy → /admin/catalogs → /admin/mediawiki-import
2026-04-24 17:03:13 +02:00
df569bbf6e fix: auth register - correct column name created_at
Some checks failed
Deploy Development / deploy (push) Successful in 38s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 1m54s
Error: column 'created' of relation 'profiles' does not exist
Fix: Changed 'created' to 'created_at' in INSERT statement
Line: backend/routers/auth.py:247
2026-04-24 16:07:13 +02:00
46d000d6b3 feat: SMW-Importer Frontend (Phase 2 complete)
Some checks failed
Test Suite / lint-backend (push) Waiting to run
Test Suite / build-frontend (push) Waiting to run
Test Suite / playwright-tests (push) Blocked by required conditions
Deploy Development / deploy (push) Has been cancelled
Phase 2A: API Functions
- 5 MediaWiki import functions in api.js
- previewMediaWikiImport, executeMediaWikiImport
- getMediaWikiImportStatus, listMediaWikiImportLogs
- deleteMediaWikiImportReference

Phase 2B: UI Component
- MediaWikiImportPage.jsx (3-tab interface)
- Preview Tab: Category selection, preview with accordions
- Execute Tab: Import form with status polling
- History Tab: Import log list with refresh

Phase 2C: Routing
- Added /admin/mediawiki-import route in App.jsx
- Import and ProtectedRoute wrapper

Issue: SMW-Importer Frontend (Option C from handover)
Related: backend/routers/csv_import.py (MediaWiki endpoints)
2026-04-24 16:06:49 +02:00
a67cc5f812 fix: exercises.py - use direct VARCHAR for age_groups (no catalog table in Shinkan)
Some checks failed
Deploy Development / deploy (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 2m0s
2026-04-24 15:27:11 +02:00
a6ea5b95eb fix: exercises.py - correct table name exercise_style_directions (all 3 occurrences)
Some checks failed
Deploy Development / deploy (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Has been cancelled
2026-04-24 15:25:17 +02:00
b617b5a2d8 fix: exercises.py - handle dict rows in fetchone() for INSERT RETURNING
Some checks failed
Deploy Development / deploy (push) Successful in 33s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Has been cancelled
2026-04-24 15:23:00 +02:00
e80c8e01e1 fix: add listTrainingStyles alias for backward-compatibility (references listStyleDirections)
Some checks failed
Deploy Development / deploy (push) Successful in 33s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Has been cancelled
2026-04-24 15:20:39 +02:00
711bdc99cb fix: Migration 014 - correct table name exercise_style_directions (not exercise_training_styles)
Some checks failed
Deploy Development / deploy (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 1m54s
2026-04-24 15:10:26 +02:00
01ed5509f8 feat: Exercises v2.0 + Migrations 014/016/017 (Clean-Room Rebuild)
Some checks failed
Deploy Development / deploy (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 1m54s
BREAKING CHANGES:
- exercises.py komplett neu gebaut (kein Legacy-Code)
- Legacy-Felder entfernt: age_groups, focus_area, secondary_areas, training_character
- Nur M:N Relations, keine JSONB-Kataloge

Migrations:
- Migration 014: Variant Progression + Search Vector + Legacy DROP
  - exercise_variants: progression_level, sequence_order, prerequisite_variant_id
  - exercises: search_vector (tsvector für Volltext-Suche)
  - DROP age_groups, focus_area, secondary_areas, training_character
  - Helper: update_timestamp() Funktion für Triggers
- Migration 016: Saved Exercise Searches
  - saved_exercise_searches (profile_id, name, filters JSONB)
- Migration 017: Exercise Blocks + Template Blocks
  - exercise_blocks (name, description, goal, is_template)
  - exercise_block_items (exercise_id, variant_id, sequence_order, is_placeholder, placeholder_criteria)

Backend (exercises.py v2.0):
- GET /exercises: Volltext-Suche via tsvector, M:N Joins
- GET /exercises/{id}: enrich_exercise_detail() mit allen M:N Relations
- POST /exercises: M:N Relations (focus_areas_multi, training_styles_multi, target_groups_multi, age_groups, skills)
- PUT /exercises: Partial Update + M:N Relations
- DELETE /exercises: Cascade-Check für exercise_block_items

Architecture:
- Issue #53 konform: Import = Feld-Zuordnung, keine fachliche Interpretation
- Helper: enrich_exercise_detail() für vollständige Objekte
- Helper: assign_exercise_relations() für M:N Management (DELETE+INSERT Pattern)

Docs:
- SMW_IMPORTER_GAP_ANALYSIS.md: Vollständige Gap-Analyse + Umsetzungsplan

Version: 0.7.0
Module: exercises 2.0.0
Schema: 20260424002
2026-04-24 15:04:27 +02:00
6801c60604 feat: Add MediaWiki import functionality with tracking and mapping
Some checks failed
Deploy Development / deploy (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m55s
- Implemented a new SQL migration for wiki import tracking tables.
- Created an import router for handling MediaWiki imports of exercises, skills, and methods.
- Developed a Semantic MediaWiki API client for direct API interactions.
- Added a mapper to convert SMW properties to local database fields.
- Introduced background tasks for asynchronous import processing.
- Implemented logging and error handling for import operations.
- Added endpoints for previewing imports, checking import status, and managing import references.
2026-04-24 14:41:52 +02:00
0e0b709768 refactor: split AdminHierarchyPage into modular components
Some checks failed
Deploy Development / deploy (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 2m0s
Split 1200+ line file into clean modular architecture:
- FocusAreaNode.jsx - Tree nodes with nested style directions + training types
- HierarchyTab.jsx - Tab 1 with tree view and detail panel
- CatalogsTab.jsx - Tab 2 with global catalogs (Target Groups, Skill Categories, Training Characters)
- AssignmentsTab.jsx - Tab 3 with M:N checkbox matrix (Style Directions ↔ Target Groups)
- DetailPanel.jsx - All edit forms (Focus Area, Style Direction, Training Type) + create forms

Fixes ESBuild parser error from large file size.
Implements full CRUD: create, edit, delete, reassign focus areas.
Responsive design with mobile/desktop layouts.
2026-04-24 09:08:12 +02:00
9ec1cf7781 fix: temporarily use simple admin hierarchy to fix build
Some checks failed
Deploy Development / deploy (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 2m2s
Large AdminHierarchyPage.jsx (1200+ lines) causes ESBuild parser error.
Using simplified version temporarily while investigating the issue.

Broken version saved as AdminHierarchyPage.broken.jsx for debugging.
Will split into modules and restore full functionality.
2026-04-24 08:57:13 +02:00
af2fc31f70 fix: build error - remove dynamic template from style tag
Some checks failed
Deploy Development / deploy (push) Failing after 31s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Failing after 2s
Test Suite / playwright-tests (push) Has been skipped
2026-04-24 08:52:12 +02:00
3fda149049 feat: complete admin system - global catalogs + M:N assignments
Some checks failed
Deploy Development / deploy (push) Failing after 10s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Failing after 2s
Test Suite / playwright-tests (push) Has been skipped
Tab System:
- Tab 1: Hierarchie (Fokusbereich → Stilrichtung/Trainingstyp)
- Tab 2: Kataloge (Zielgruppen, Fähigkeiten, Trainingscharakter)
- Tab 3: Zuordnungen (Matrix Stilrichtungen ↔ Zielgruppen)

Global Catalogs (Tab 2):
- Zielgruppen: CRUD mit Altersangaben (zentral verwaltet)
- Fähigkeitskategorien: CRUD (global)
- Trainingscharakter: CRUD (global)
- Reusable CatalogSection component with dynamic fields
- Create/Edit/Delete für alle Kataloge
- Inline editing + validation

M:N Assignments Matrix (Tab 3):
- Checkbox-Grid: Stilrichtungen (Zeilen) × Zielgruppen (Spalten)
- Grouped by Focus Area for clarity
- Toggle assignments with immediate save
- Shows empty states with helpful messages
- Fully responsive table with horizontal scroll

Architecture:
- Trainingstypen: Context-specific per focus area (create new)
- Zielgruppen: Global catalog (assign via matrix)
- Clean separation of concerns
- Proper loading states + error handling

Mobile responsive across all tabs.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-24 08:46:32 +02:00
80986735b5 feat: complete admin hierarchy - create + reassign functions
Some checks failed
Deploy Development / deploy (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m54s
Create Functions:
- '+ Neu' buttons for Style Directions and Training Types
- Create forms with focus area context
- Auto-assigns to parent focus area
- Loading states + validation

Reassignment:
- Focus area dropdown in edit forms
- Move style directions between focus areas
- Move training types between focus areas
- Updates hierarchy immediately after save

Full CRUD now complete:
- Create: new elements under focus area
- Read: tree view with nested elements
- Update: edit + reassign to different focus area
- Delete: with confirmation dialogs

Mobile + Desktop responsive design maintained.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-24 08:39:48 +02:00
af89546022 feat: complete admin hierarchy - edit/delete + responsive design
Some checks failed
Deploy Development / deploy (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m54s
Features:
- Edit forms for Style Directions and Training Types (working)
- Delete functions with confirmation dialogs
- Responsive layout: mobile (stacked), tablet/desktop (side-by-side)
- Back button on mobile to return to tree view
- Full CRUD except create (can use old catalogs page for now)

Mobile UX:
- Tree view fills screen
- Click item → detail panel replaces tree
- Back button → return to tree
- Safe bottom padding for navigation

Desktop UX:
- 400px tree + fluid detail panel
- Both always visible
- No back button (not needed)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-24 08:33:11 +02:00
599d696321 fix: add getAdminHierarchy to api export object
Some checks failed
Deploy Development / deploy (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 2m0s
2026-04-24 08:25:03 +02:00
7314ae1436 feat: Hierarchical Admin UI - Tree View for Catalogs
Some checks failed
Deploy Development / deploy (push) Successful in 1m2s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 7s
Test Suite / playwright-tests (push) Failing after 1m56s
Backend:
- New endpoint: GET /api/admin/hierarchy
- Returns hierarchical structure: Focus Areas with nested Style Directions + Training Types
- Style Directions include target_groups assignments (M:N)
- JSON aggregation for efficient data loading

Frontend:
- New page: AdminHierarchyPage.jsx with Tree + Detail Panel layout
- Tree View: Expandable/collapsible nodes (Focus Areas → Stilrichtungen/Trainingstypen)
- Detail Panel: Shows selected item details, inline editing
- Visual hierarchy: Icons, indentation, color coding
- Responsive layout: Fixed 400px tree, fluid detail panel

Routes:
- /admin now redirects to /admin/hierarchy (new default)
- /admin/hierarchy: Tree-based catalog management
- /admin/catalogs: Legacy flat UI (still available)

UX Improvements:
- Visual hierarchy instead of flat tabs
- M:N relationships visible (target groups per style)
- Better navigation: Click to select, expand/collapse sections
- Cleaner layout: Two-column design

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-24 07:51:40 +02:00
0be9fd840c fix: remove incompatible schema_migrations tracking from migrations 012-013
Some checks failed
Deploy Development / deploy (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m55s
The db_init.py system uses (filename, applied_at) schema, not (version, description).
Removing manual INSERT statements - db_init.py handles tracking automatically.
2026-04-23 16:17:35 +02:00
fe5d29e40e feat: Training Types → Focus Area Hierarchie
Some checks failed
Deploy Development / deploy (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m55s
Migration 013:
- Adds focus_area_id to training_types (context-specific types)
- Migrates existing data to Karate focus area
- Seeds focus-area-specific training types:
  * Karate: Dan-Vorbereitung
  * Gewaltschutz: Präventivkurse, Intensivtraining, Spezialkurse
  * Fitness: Gesundheitssport, Funktionelles Training
- Updates unique constraint to (name, focus_area_id)

Backend (catalogs.py):
- list_training_types: Added focus_area_id filter, LEFT JOIN focus_areas
- create_training_type: Added focus_area_id parameter
- update_training_type: Added focus_area_id parameter
- Enriched responses with focus_area_name and focus_area_icon

Frontend (AdminCatalogsPage):
- Added Fokusbereich dropdown to create form
- Added Fokusbereich dropdown to edit form
- Display shows focus_area_icon and focus_area_name
- Training types now context-specific to focus areas

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-23 15:29:23 +02:00
9f44cff77b fix: Stilrichtungen → Fokusbereich Zuordnung (focus_area_id)
Some checks failed
Deploy Development / deploy (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m54s
Problem: Stilrichtungen-Tab zeigte falsches Feld 'Übergeordneter Stil' (parent_style_id)
Lösung: Fokusbereich-Dropdown (focus_area_id) für Hierarchie

Backend (catalogs.py):
- INSERT: focus_area_id Parameter hinzugefügt
- UPDATE: focus_area_id Parameter hinzugefügt
- SELECT: LEFT JOIN focus_areas für focus_area_name + icon
- Response enriched mit focus_area_name/icon

Frontend (AdminCatalogsPage.jsx):
- newTS State: parent_style_id → focus_area_id
- Create Form: Fokusbereich-Dropdown statt 'Übergeordneter Stil'
- Edit Form: Fokusbereich-Dropdown mit focusAreas
- Display: Zeigt Fokusbereich-Icon + Name (accent color)
- parent_style_id bleibt für optionale Stil-Hierarchien

Jetzt kann Hierarchie korrekt angelegt werden:
 Karate → Goju-Ryu
 Karate → Shotokan
 Gewaltschutz → (eigene Stilrichtungen)

version: 0.5.0
module: catalogs 1.5.0, AdminCatalogsPage 2.2.0

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-23 14:36:02 +02:00
377f365473 feat: Add TrainerContextsPage to navigation
Some checks failed
Deploy Development / deploy (push) Successful in 34s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m54s
- Import TrainerContextsPage in App.jsx
- Add route /trainer-contexts
- Add 'Meine Bereiche' to main navigation (appNav.js)
- Icon: Target (Zielscheibe) für Trainer-Bereiche
- Visible in both desktop sidebar and mobile bottom nav

version: 0.5.0
module: TrainerContextsPage 1.0.0

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-23 14:26:10 +02:00
5e2820c63c feat: Trainer-Kontext-System & Exercise Training Characters (v0.5.0)
Some checks failed
Deploy Development / deploy (push) Successful in 33s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m55s
Migration 012:
- exercise_training_characters (M:N junction table)
- trainer_contexts (Fokussierte Trainer-Ansichten)
- Indizes für Performance
- Example seed data

Backend (catalogs.py):
- GET /api/trainer-contexts (list own contexts)
- POST /api/trainer-contexts (create context)
- PUT /api/trainer-contexts/{id} (update own context)
- DELETE /api/trainer-contexts/{id} (delete own context)
- Enriched responses mit focus_area_name, style_direction_name, training_type_name
- Ownership-Validation (nur eigene Kontexte)

Frontend:
- TrainerContextsPage.jsx (vollständige CRUD-UI)
- Kaskadierende Dropdowns (Fokusbereich → Stilrichtung)
- is_style_independent Flag für stilunabhängige Kontexte
- api.js erweitert (listTrainerContexts, create, update, delete)

Architektur:
- Flat Catalogs mit M:N überall
- NULL = 'für alles geeignet'
- Trainer-Kontexte für fokussierte Ansichten
- Vorbereitung für 1000+ Übungen mit flexibler KI-Filterung

version: 0.5.0 (backend + frontend)
module: exercises 0.5.0, catalogs 1.5.0
page: TrainerContextsPage 1.0.0

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-23 14:22:17 +02:00
9ab2bd31fa fix: Update onClick handlers to use renamed functions
Some checks failed
Deploy Development / deploy (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m55s
- createTrainingStyle → createStyleDirection
- updateTrainingStyle → updateStyleDirection
- deleteTrainingStyle → deleteStyleDirection

Fixes: Stilrichtungen tab showed blank screen due to undefined function calls

version: 0.4.0 (frontend)
module: AdminCatalogsPage 2.2.0

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-23 12:57:23 +02:00
426efd4b83 fix: Frontend API Calls & Field Names für renamed tables
Some checks failed
Deploy Development / deploy (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 1m55s
- Updated api.js function names:
  - listTrainingStyles → listStyleDirections
  - createTrainingStyle → createStyleDirection
  - updateTrainingStyle → updateStyleDirection
  - deleteTrainingStyle → deleteStyleDirection
  - listTrainingStyleTargetGroups → listStyleDirectionTargetGroups
  - createTrainingStyleTargetGroup → createStyleDirectionTargetGroup
  - updateTrainingStyleTargetGroup → updateStyleDirectionTargetGroup
  - deleteTrainingStyleTargetGroup → deleteStyleDirectionTargetGroup
  - getTrainingStylesHierarchy → getStyleDirectionsHierarchy
- Updated AdminCatalogsPage.jsx:
  - loadData() uses renamed API functions
  - CRUD functions renamed (createStyleDirection, etc.)
  - Matrix uses style_direction_id parameter
  - Hierarchy renders style_directions array
- Fixes data binding between frontend and backend after table rename

version: 0.4.0 (frontend)
module: AdminCatalogsPage 2.2.0

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-23 12:27:09 +02:00
155c21f018 fix: Backend SQL Queries für renamed tables (Migration 010+011)
- Updated all SQL queries in catalogs.py to use renamed tables:
  - training_styles → style_directions
  - training_style_target_groups → style_direction_target_groups
  - exercise_styles → exercise_style_directions
- Updated API parameter names: training_style_id → style_direction_id
- Updated response field names: training_style_name → style_direction_name
- Updated array field names: training_styles → style_directions
- Fixes 'failed to fetch' errors on Stilrichtungen, Hierarchie, Zuordnungen tabs

version: 0.4.0 (backend)
module: catalogs 1.4.0

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-23 12:24:50 +02:00
a9a4c78a0e feat: Admin-UI Trainingsstil-Dimension + Umbenennung
Some checks failed
Deploy Development / deploy (push) Successful in 33s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m54s
Admin-UI Erweiterung:

1. Tab "Trainingsstile" → "Stilrichtungen" umbenannt
   - Überschrift: "Neue Stilrichtung" (statt Trainingsstil)
   - Tab-Label: "Stilrichtungen"

2. Neuer Tab "Trainingsstil" (Breitensport/Leistungssport)
   - CRUD-UI: Create/Update/Delete
   - Felder: Name, Kürzel (abbreviation), Beschreibung
   - State: trainingTypes, editingTT, newTT
   - Funktionen: createTrainingType, updateTrainingType, deleteTrainingType
   - Load-Logik: activeTab === 'training-types'

Tab-Reihenfolge:
- Fokusbereiche → Stilrichtungen → Trainingsstil → Hierarchie → Zielgruppen → Zuordnungen

Pattern: Konsistent mit anderen Katalog-Tabs
Version: AdminCatalogsPage 2.1.0
2026-04-23 12:17:31 +02:00
72c927e69e feat: Backend API für training_types + Frontend api.js
Some checks failed
Deploy Development / deploy (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 1m55s
Backend (catalogs.py):
- GET /api/training-types (Liste)
- POST /api/training-types (Erstellen)
- PUT /api/training-types/{id} (Bearbeiten)
- DELETE /api/training-types/{id} (Löschen mit CASCADE-Check)
- Cascade-Protection: Fehler wenn Übungen zugeordnet

Frontend (api.js):
- listTrainingTypes(filters)
- createTrainingType(data)
- updateTrainingType(id, data)
- deleteTrainingType(id)
- Export zum api-Objekt hinzugefügt

Pattern: Konsistent mit anderen Katalog-Endpoints
CRUD: Volle Admin-Verwaltung

Version: 0.4.0
2026-04-23 12:12:48 +02:00
62b5b4c2fd feat: Migration 010+011 - Stilrichtungen + Trainingsstil-Dimension
Some checks failed
Deploy Development / deploy (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Has been cancelled
Migration 010: Umbenennung (konsistente Terminologie)
- training_styles → style_directions
- exercise_styles → exercise_style_directions
- training_style_target_groups → style_direction_target_groups
- training_style_id → style_direction_id (in Junction-Tabellen)
- Idempotent mit IF EXISTS checks

Migration 011: Neue Dimension "Trainingsstil"
- Neue Tabelle training_types (Breitensport, Leistungssport, Wettkampf)
- Seed-Daten: 3 Standard-Trainingsstile
- Junction-Tabelle exercise_training_types (M:N)
- Indizes für Performance
- ON DELETE RESTRICT: Training Types können nicht gelöscht werden wenn zugeordnet

Architektur:
- Fokusbereich (Karate) → Stilrichtung (Shotokan) → Trainingsstil (Breitensport) → Zielgruppe (Kinder)
- Alle M:N für maximale Flexibilität
- KI-freundlich: Flache Dimensionen, einfache Queries

Version: 0.4.0 (BREAKING - nur DB-Migrationen, Backend/Frontend folgen)
2026-04-23 12:10:27 +02:00
cedb97eb9b docs: Phase D - Dokumentation Migration 009
Some checks failed
Deploy Development / deploy (push) Successful in 40s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 2m4s
Dokumentations-Updates:

DATABASE_SCHEMA.md:
- Version 0.3.4
- Migration 009 zur Historie hinzugefügt
- target_groups Struktur korrigiert (M:N statt 1:N)
- training_style_target_groups Junction-Tabelle dokumentiert
- Backend API Endpoints dokumentiert (5 neue)
- Frontend Admin-UI Änderungen dokumentiert

DOMAIN_MODEL.md:
- Version 0.3.4
- Dimension 3 (Zielgruppe) komplett überarbeitet
- Hierarchischer Kontext aktualisiert (M:N Architektur)
- Admin-UI Darstellung erklärt (Tree-View + Matrix + Global)
- BREAKING CHANGE klar gekennzeichnet

Fachlich:
- Zielgruppen sind jetzt GLOBAL (nicht mehr hierarchisch)
- M:N Zuordnung über Junction-Tabelle
- Wiederverwendbarkeit: Eine Zielgruppe → mehrere Stile

Version: 0.3.4
2026-04-23 11:00:50 +02:00
f243b236be feat: Phase C - Admin-UI M:N Hierarchie & Matrix
Some checks failed
Deploy Development / deploy (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 2m1s
Frontend Admin-UI Refactoring (komplett):

1. Target Groups Tab überarbeitet (Global):
   - training_style_id Dropdown entfernt (Create + Edit)
   - Hierarchie-Anzeige entfernt (jetzt global unabhängig)
   - Nur noch Name, Beschreibung, Altersbereich

2. Neuer Tab 'Hierarchie' (Tree-View):
   - Fokusbereich → Trainingsstil → Zielgruppen
   - Expandable/Collapsible Nodes (▶/▼)
   - is_primary Kennzeichnung (★)
   - Hierarchische Darstellung mit Einrückung

3. Neuer Tab 'Zuordnungen' (M:N Matrix):
   - Checkbox-Matrix: Stile × Zielgruppen
   - Live-Toggle (Checkbox on/off)
   - Focus Area Kontext bei jedem Stil
   - is_primary Flag Anzeige (★)

UX:
- Tab-Reihenfolge: Fokusbereiche → Stile → Hierarchie → Zielgruppen → Zuordnungen
- Responsive Tabelle mit Overflow-Scroll
- Konsistente Card-basierte Layouts

Version: 0.3.4
Page: AdminCatalogsPage 2.0.0
2026-04-23 10:55:35 +02:00
1891a4ab88 feat: Phase B - Frontend API für M:N Zielgruppen
Some checks failed
Deploy Development / deploy (push) Successful in 33s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 2m2s
Frontend API Layer:
- 5 neue api.js Funktionen für M:N Management
- listTrainingStyleTargetGroups(filters) - Liste mit Filtern
- createTrainingStyleTargetGroup(data) - Neue Zuordnung
- updateTrainingStyleTargetGroup(id, data) - is_primary ändern
- deleteTrainingStyleTargetGroup(id) - Zuordnung löschen
- getTrainingStylesHierarchy() - Hierarchische Struktur für Tree-View

Pattern: Konsistent mit bestehenden Catalog-Funktionen
Export: Alle Funktionen zum api-Objekt hinzugefügt

Version: 0.3.4 (Phase B)
2026-04-23 10:45:14 +02:00
1e5e18c0b3 feat: Migration 009 - Zielgruppen M:N Refactoring
Some checks failed
Deploy Development / deploy (push) Successful in 33s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m57s
Backend Phase A (Database + API):
- Migration 009: target_groups.training_style_id entfernt
- Migration 009: Neue Junction-Tabelle training_style_target_groups
- Migration 009: Datenmigration alte → neue Struktur (idempotent)
- API: 5 neue Endpoints für M:N Management
  * GET /training-style-target-groups (mit Enrichment)
  * POST /training-style-target-groups (Upsert-Logik)
  * PUT /training-style-target-groups/{id} (is_primary)
  * DELETE /training-style-target-groups/{id}
  * GET /training-styles/hierarchy (für Tree-View)
- API: GET/POST/PUT /target-groups jetzt global (ohne training_style_id)
- API: DELETE /target-groups prüft beide Tabellen (CASCADE-Schutz)

Architecture:
- Eine Zielgruppe kann mehreren Stilen zugeordnet werden
- Basis für Admin Tree-View + M:N Matrix UI

Version: 0.3.4
Module: catalogs 1.3.0
2026-04-23 10:37:56 +02:00
2a5f06a8f5 feat: Refactor target groups to M:N relationship and update related endpoints
Some checks failed
Deploy Development / deploy (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m55s
2026-04-23 09:27:13 +02:00
2186bb3a69 fix: Admin-Navigation - Redirect /admin → /admin/catalogs
Some checks failed
Deploy Development / deploy (push) Successful in 34s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 2m1s
Problem: Navigation-Link zeigte /admin, aber Route war /admin/catalogs
Folge: Klick auf 'Admin' führte zu 404 (Catch-all Redirect zu /)

Fix: Redirect-Route von /admin zu /admin/catalogs hinzugefügt

version: 0.3.3
2026-04-23 09:00:28 +02:00
278d719e84 feat: Zielgruppen-Verwaltung (Target Groups CRUD + Admin UI)
Some checks failed
Deploy Development / deploy (push) Successful in 32s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m54s
Backend:
- GET /api/target-groups: Liste mit hierarchischem Kontext (focus_area → training_style → target_group)
- POST /api/target-groups: Create (admin only)
- PUT /api/target-groups/{id}: Update (admin only)
- DELETE /api/target-groups/{id}: Delete (superadmin only) mit CASCADE-Schutz
- Filter: by training_style_id, status

Frontend:
- api.js: listTargetGroups, createTargetGroup, updateTargetGroup, deleteTargetGroup
- AdminCatalogsPage: Neuer Tab "Zielgruppen" (6. Tab)
- Create-Form: training_style_id, name, description, min_age, max_age
- List-View: Hierarchie-Anzeige (Fokusbereich → Stil → Zielgruppe + Altersbereich)
- Inline-Editing mit Stil-Auswahl-Dropdown
- Delete mit Confirmation Dialog

Architektur:
- Hierarchische Beziehung: target_groups.training_style_id → training_styles → focus_areas
- CASCADE-Protection: DELETE verweigert wenn exercise_target_groups Einträge existieren
- Backend liefert enriched data mit training_style_name + focus_area_name

version: 0.3.2
modules: catalogs 1.2.0
pages: AdminCatalogsPage 1.1.0
2026-04-23 08:55:54 +02:00
d67f659e97 feat: Exercises-Router M:N Zuordnungen
Some checks failed
Deploy Development / deploy (push) Successful in 34s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 4s
Test Suite / playwright-tests (push) Failing after 1m57s
Backend API erweitert um M:N Katalog-Zuordnungen:
- GET /exercises/{id}: Liefert focus_areas[], training_styles[], target_groups[], age_groups_catalog[]
- POST /exercises: Akzeptiert focus_areas_multi[], training_styles_multi[], target_groups_multi[], age_groups_catalog[]
- PUT /exercises/{id}: DELETE+INSERT Pattern für M:N Updates (konsistent mit skills)

Rückwärtskompatibilität:
- Legacy FK-Felder (focus_area_id, training_style_id, training_character_id) bleiben erhalten
- Alte Aufrufe funktionieren unverändert
- Neue M:N Felder sind optional

version: 0.3.1
modules: exercises 0.4.0
2026-04-23 08:51:45 +02:00
c7444ecaec docs: mark migration 008 as deployed
Some checks failed
Deploy Development / deploy (push) Successful in 34s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m54s
2026-04-23 08:48:54 +02:00
63b1c09975 feat: Migration 008 - M:N Exercise Relations + Hierarchical Catalogs
Some checks failed
Deploy Development / deploy (push) Successful in 34s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Has been cancelled
BREAKING CHANGE: Datenmodell-Umstellung von 1:1 auf M:N Beziehungen

Migration 008:
- Zielgruppen-Tabelle (target_groups) mit training_style_id Hierarchie
- M:N Zuordnungstabellen: exercise_focus_areas, exercise_styles, exercise_target_groups
- Altersgruppen-Dimension (exercise_age_groups) mit CHECK constraint
- Hierarchische Struktur: training_styles.focus_area_id → focus_areas
- Daten-Migration: Bestehende 1:1 Beziehungen zu M:N mit is_primary=true
- Seed-Daten: Beispiel-Zielgruppen für Shotokan

Architektur:
- Smart Cascade-Logik (RESTRICT, Rerouting, Move) vorbereitet
- Legacy-Spalten (focus_area_id, training_style_id) bleiben zur Rückwärtskompatibilität
- Primary/Secondary Assignments via is_primary Flag

Dokumentation:
- .claude/docs/technical/DATABASE_SCHEMA.md (kontinuierlich gepflegt)
- .claude/docs/functional/DOMAIN_MODEL.md (fachliche Anforderungen)
- Migrations-Historie aktualisiert

version: 0.3.0 (backend + frontend)
modules: exercises 0.3.0, catalogs 1.1.0
DB_SCHEMA_VERSION: 20260423

Konzept: shinkan_anforderungsdokument_entwurf.md (§8.1, §8.3, §10.7)
2026-04-23 08:46:56 +02:00