Refactor Falukant daemon logic for time-based processing: Updated the handling of monthly servant costs and lover installments to align with the new game time model, introducing a unified "Monatstick" concept for cost calculations. Enhanced SQL queries and worker logic to ensure accurate processing every 2 hours, improving financial interactions and family dynamics.

This commit is contained in:
Torsten Schulz (local)
2026-03-23 10:11:49 +01:00
parent c82fbc0f7c
commit 708ffc3eda
7 changed files with 78 additions and 24 deletions

View File

@@ -2103,8 +2103,9 @@ pub const QUERY_GET_SERVANT_MONTHLY_ROWS: &str = r#"
JOIN falukant_data.character c ON c.user_id = fu.id AND c.health > 0
LEFT JOIN falukant_type.title t ON t.id = c.title_of_nobility
LEFT JOIN falukant_type.house ht ON ht.id = uh.house_type_id
-- Monatstick (Spielzeit): alle ~2 h, nicht Kalendermonat (siehe docs/FALUKANT_DAEMON_AENDERUNGSNOTIZ_ZEITMASSSTAB.md)
WHERE (uh.servants_last_monthly_at IS NULL
OR date_trunc('month', uh.servants_last_monthly_at) < date_trunc('month', CURRENT_TIMESTAMP))
OR uh.servants_last_monthly_at < NOW() - INTERVAL '2 hours')
AND NOT EXISTS (
SELECT 1 FROM falukant_type.house h
WHERE h.id = uh.house_type_id AND h.label_tr = 'under_bridge'