Backend: gamification.py endpointok GamificationService-re átállítása #328
Notifications
Total Time Spent: 33 minutes
kincses
33 minutes
No due date set.
Dependencies
No dependencies set.
Reference: kincses/service-finder#328
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
Mérföldkő: Epic 8 Gamification 2.0, Verseny és Önvéde
Cél: A gamification.py végpontokban (submit-service, quiz/answer, badges/award) a direkt UserStats módosítások lecserélése a GamificationService használatára
🔗 Függőségek (Dependencies)
📝 Elemzés
A backend/app/api/v1/endpoints/gamification.py számos végpontja (submit-service, quiz/answer, badges/award, stb.) közvetlenül módosítja a UserStats tábla mezőit (total_xp, social_points, total_points) a GamificationService megkerülésével. Ez kettős állapottartáshoz (drift) vezethet a game engine és a tényleges adatok között.
Javítandó helyek:
▶️ Munka megkezdve: 2026-06-29 20:54:15
✅ Munka befejezve: 2026-06-29 21:28:10
Technikai Összefoglaló:
Gamification Admin Integration bugfixes: (1) gamification.py: fixed metadata->provided_fields, added missing logger import, added action_type/earned_xp fields; (2) admin_gamification.py: fixed get_setting->get_scoped_parameter; (3) system_service.py: fixed set_scoped_parameter upsert logic for NULL scope_id (PostgreSQL NULL-in-unique-constraint issue). All 18 admin gamification endpoints tested successfully ✅
⏱️ Az idő rögzítve.
✅ Gitea #328 - Gamification Admin Integration - Completed
All tasks for Gitea card #328 ("Backend: gamification.py endpointok Gami") have been completed successfully.
🔧 Bugs Fixed
1.
gamification.py- submit-service endpoint (3 bugs):import loggingandlogger = logging.getLogger("gamification-endpoints")metadata={...}→provided_fields={...}(theUserContributionmodel usesprovided_fieldsas the JSONB field name)action_type=1,earned_xp=submission_rewards.get("xp", 100)2.
admin_gamification.py- master-config endpoint:system_service.get_setting()→system_service.get_scoped_parameter()(method didn't exist)system_service.set_setting()→system_service.set_scoped_parameter()(same reason)3.
system_service.py- set_scoped_parameter upsert logic:ON CONFLICT ON CONSTRAINT uix_param_scopeapproach failed whenscope_id IS NULLbecause PostgreSQL's UNIQUE constraint allows multiple NULL values (NULL != NULL in SQL)system.system_parameters.scope_levelaltered from custom PostgreSQL enum toVARCHAR(50)for SQLAlchemy compatibility✅ Test Results
/admin/gamification/user-stats/{id}/penaltyand/reward/admin/users/{id}/penalty✅ Still works via GamificationService