Enhance church office management in Falukant daemon: Introduced falukantUpdateChurch event for church applications and appointments, updated SQL queries for church office processing, and refactored the PoliticsWorker to streamline daily tasks related to church offices. Improved handling of church application scoring and interim appointments, enhancing overall church dynamics and character interactions.

This commit is contained in:
Torsten Schulz (local)
2026-03-23 11:02:19 +01:00
parent 708ffc3eda
commit 9d7f61a329
5 changed files with 796 additions and 222 deletions

View File

@@ -0,0 +1,20 @@
-- Höchste erreichte kirchliche Hierarchiestufe (Laufbahn), nicht zurücksetzen bei Amtsverlust.
-- Siehe docs/FALUKANT_CHURCH_DAEMON.md
ALTER TABLE falukant_data.character
ADD COLUMN IF NOT EXISTS highest_church_hierarchy_ever SMALLINT;
COMMENT ON COLUMN falukant_data.character.highest_church_hierarchy_ever IS
'Max. hierarchy_level (church_office_type) jemals erreicht; für Bewerbungsvoraussetzungen neben aktuellem Amt';
UPDATE falukant_data.character c
SET highest_church_hierarchy_ever = sub.mh::smallint
FROM (
SELECT co.character_id AS cid,
MAX(cot.hierarchy_level)::int AS mh
FROM falukant_data.church_office co
JOIN falukant_type.church_office_type cot ON cot.id = co.office_type_id
GROUP BY co.character_id
) sub
WHERE c.id = sub.cid
AND (c.highest_church_hierarchy_ever IS NULL OR c.highest_church_hierarchy_ever < sub.mh);