Files
service-finder/plans/logic_spec_point_rules_admin_fix.md
2026-07-01 02:27:38 +00:00

4.4 KiB

Logic Spec: Pontszabalyok Admin Oldal Javitasa

Modul Celja es Masterbook 2 Illeszkedes

  • Modul: Gamification -> Admin -> Point Rules
  • Masterbook 2 kapcsolat: Admin felulet a gamification pontszabalyok kezelesere (CRUD)
  • Jelenlegi allapot: Backend API 100%-ig funkcionalis, frontenden i18n kulcs mismatch es hianyzó inline szerkesztes

Audit Eredmenyek

Backend API (admin_gamification.py) - igenyel valtoztatast

  • GET /admin/gamification/point-rules - Listazas, minden mezovel
  • POST /admin/gamification/point-rules - Letrehozas, 409-es duplicate_key hibaval
  • PUT /admin/gamification/point-rules/{id} - Reszleges frissites exclude_unset=True
  • DELETE /admin/gamification/point-rules/{id} - Soft-delete (is_active=False)
  • PointRule modell: id, action_key (unique), points, description, is_active - minden szerkesztheto
  • Kovetkeztetes: Backend modositas NEM szukseges

Frontend i18n Kulcs Mismatch - 13 hibas kulcs

A Vue template (point-rules.vue) rossz i18n kulcsokat hasznal. A locale fajlok (en.json, hu.json) tartalmazzak a helyes kulcsokat.

# Template hasznal Helyes kulcs (locale) Sor
1 col_id id 41
2 col_action_key action_key 42
3 col_points points 43
4 col_description description 44
5 col_status status 45
6 col_actions actions 46
7 create_btn create 32
8 empty no_items 83
9 load_error error 21
10 duplicate_error duplicate_key 316
11 delete_confirm_title delete_title 168
12 delete_confirm_body (param: {action_key}) delete_confirm (param: {name}) 170
13 active_label is_active 143

Hianzo Funkcio: Inline Szerkesztes

  • Jelenleg csak modal (popup) alapu szerkesztes erheto el a ceruza ikonra kattintva
  • A tablazat cellai csak olvashatoak (read-only)
  • A felhasznalo kerese: kattintasra inline szerkesztes

Tervezett Valtoztatasok

1. i18n Kulcsok Javitasa (point-rules.vue)

Csak a frontend_admin/pages/gamification/point-rules.vue fajlban kell a template i18n hivasokat javitani.

Valtoztatasok (13 helyen):

    1. sor: th col_id -> th id
    1. sor: th col_action_key -> th action_key
    1. sor: th col_points -> th points
    1. sor: th col_description -> th description
    1. sor: th col_status -> th status
    1. sor: th col_actions -> th actions
    1. sor: create_btn -> create
    1. sor: empty -> no_items
    1. sor: load_error -> error
    1. sor: duplicate_error -> duplicate_key
    1. sor: delete_confirm_title -> delete_title
    1. sor:
    • Kulcs: delete_confirm_body -> delete_confirm
    • Parameter: { action_key: deletingRule?.action_key } -> { name: deletingRule?.action_key }
    1. sor: active_label -> is_active

2. Inline Szerkesztes Bevezetese (point-rules.vue)

Megkozelites: Click-to-edit minta. Amikor a felhasznalo rakattingat egy cella ertekere, az egy inline input mezove alakul.

Mely mezők legyenek inline szerkeszthetoek:

  • action_key (52-54. sor) - szoveges input
  • points (55-58. sor) - number input
  • description (60. sor) - szoveges input
  • is_active statusz (61-64. sor) - toggle/click

Implementacios terv (Vue 3 Composition API):

Uj state valtozok:

  • editingCell = ref null - { id: number; field: string }
  • editValue = ref null - string | number | boolean

Uj metodusok:

  • startEdit(rule, field) - beallitja az editingCell-t es editValue-t
  • cancelEdit() - torli az editingCell-t
  • saveEdit(rule, field) - PUT /admin/gamification/point-rules/{id} a modositott mezovel

Template modositas: Minden cella kap egy @click handler-t, ami elinditja az inline szerkesztest. Az input mezok Enter/Blur eseteben mentenek, Escape eseteben megszakitjak.

Valtoztatas Nelkuli Fajlok

  • backend/app/api/v1/endpoints/admin_gamification.py - backend API teljesen megfelelo
  • backend/app/models/gamification/gamification.py - PointRule modell helyes
  • frontend_admin/i18n/locales/en.json - kulcsok rendben
  • frontend_admin/i18n/locales/hu.json - kulcsok rendben

Csak Valtoztatando Fajlok

  • frontend_admin/pages/gamification/point-rules.vue - i18n javitas + inline szerkesztes

Tesztelesi Terv

  1. i18n: Minden oszlopfejlecben, gombon es uzenetben a forditott szoveg jelenjen meg
  2. Inline szerkesztes: Kattintasra jelenjen meg az input mezo, Enter/Blur mentse, Escape szakitsa meg
  3. Meglevo funkciok: A modal alap CRUD tovabbra is mukodjon