Update version and edition in Cargo.toml; enhance breakup risk management in FalukantFamilyWorker: Added logic to automatically deactivate low-affection relationships and notify users of high breakup risks. Updated SQL queries to support these changes.
Some checks failed
Deploy yourpart (blue-green) / deploy (push) Failing after 3s

This commit is contained in:
Torsten Schulz (local)
2026-04-13 12:21:35 +02:00
parent 10f71ece0e
commit 2cca0da750
3 changed files with 71 additions and 2 deletions

View File

@@ -444,6 +444,11 @@ SELECT tpw.region_id, tpw.product_id, tpw.worth_percent FROM falukant_data.town_
"#;
// Political offices and cumulative tax
//
// `falukant_type.political_office_type.term_length`: überall als **Kalendertage** (Integer),
// nie als Jahre. Ablauf: `po.created_at + term_length * INTERVAL '1 day'`.
// Steht in den Stammdaten z.B. `4` für „4 Jahre“, wären das faktisch **4 Tage** — dann
// Werte auf Tage umrechnen (z.B. 4 Jahre → 1460) oder die Spalte/Seed-Daten korrigieren.
pub const QUERY_GET_USER_OFFICES: &str = r#"
SELECT po.id AS office_id, pot.name AS office_name, po.region_id, rt.label_tr AS region_type
FROM falukant_data.political_office po
@@ -3574,6 +3579,15 @@ pub const QUERY_MARK_LOVER_MONTHLY_DONE: &str = r#"
WHERE relationship_id = $1::int;
"#;
/// Daily: automatisches Beenden einer Liebschaft bei anhaltend niedriger Zuneigung.
pub const QUERY_DEACTIVATE_LOVER_RELATIONSHIP: &str = r#"
UPDATE falukant_data.relationship_state
SET active = false,
updated_at = NOW()
WHERE relationship_id = $1::int
AND active = true;
"#;
/// Liebschaft: fällige Teilzahlung (alle 2 h), Migration `006_falukant_lover_installments.sql`.
pub const QUERY_GET_ACTIVE_LOVER_ROWS_FOR_INSTALLMENT: &str = r#"
SELECT