Backend: Expense auto-discovery hook PROVIDER_DISCOVERY/CONFIRMATION/VERIFIED_USE #360
Notifications
Total Time Spent: 3 minutes
kincses
3 minutes
No due date set.
Dependencies
No dependencies set.
Reference: kincses/service-finder#360
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ő: Service Provider Discovery & Gamification Integration
Cél: Az expense létrehozás végpontba (expenses.py create_expense) auto-discovery hook bekötése, amely a find_or_create_provider_by_name() segítségével automatikusan felfedezi az új providereket és kiosztja a megfelelő gamification pontokat.
🔗 Függőségek (Dependencies)
📝 Elemzés
A create_expense végpontban (566. sor környéke):
Hivatkozás: docs/gamification_provider_connection_analysis.md (6.2 szekció)
▶️ Munka megkezdve: 2026-06-30 14:41:24
✅ Munka befejezve: 2026-06-30 14:44:26
Technikai Összefoglaló:
Card #360 implementálva: (1) _deep_merge_config() hozzáadva a gamification_service.py-hoz, amely automatikusan kiegészíti a GAMIFICATION_MASTER_CONFIG hiányzó kulcsait (penalty_logic, xp_logic, stb.) a default config-ból — ez megoldja a KeyError hibát. (2) Provider auto-discovery hook bekötve a create_expense végpontba (expenses.py): ha external_vendor_name meg van adva de service_provider_id nincs, meghívja a find_or_create_provider_by_name()-t, amely felderíti/létrehozza a providert és kiosztja a gamification pontokat (PROVIDER_DISCOVERY/CONFIRMATION/VERIFIED_USE). (3) DB-ben lévő GAMIFICATION_MASTER_CONFIG (ID=34) frissítve a hiányzó kulcsokkal.
⏱️ Az idő rögzítve.
✅ Card #360 completed successfully
What was done:
1. 🔧 Fixed
GAMIFICATION_MASTER_CONFIGmissingpenalty_logickey_deep_merge_config()utility function that recursively merges the database config with the default config, ensuring all required keys (penalty_logic,xp_logic,conversion_logic,level_rewards) are always present.process_activity(), after loading the config from DB, the deep merge is applied so that even if the DB config is incomplete (as was the case), the missing keys are filled from the default.GAMIFICATION_MASTER_CONFIG(ID=34) with value{'test': ..., 'nested': ...}— completely missing all required keys. The DB entry was also updated with the proper config structure.2. 🚀 Implemented Provider Auto-Discovery Hook in
create_expensefind_or_create_provider_by_name()fromprovider_service.expenses.py:567:external_vendor_nameis provided ANDservice_provider_idis NOT provided → callsfind_or_create_provider_by_name()PROVIDER_DISCOVERY), confirmation (existing non-approved →PROVIDER_CONFIRMATION), verified use (existing approved →PROVIDER_VERIFIED_USE)_award_provider_points()provider.idis used asservice_provider_idin theAssetCostcreationVerification:
penalty_logickey automatically filled from defaultcfg["penalty_logic"]accesses succeed without KeyError