Add logic to prevent multiple births for mothers in a single day: Implemented a new SQL query to check if a mother has already given birth today. Updated the FalukantFamilyWorker and UserCharacterWorker to utilize this check, enhancing the birth registration process and ensuring compliance with the new birth rule.
All checks were successful
Deploy yourpart (blue-green) / deploy (push) Successful in 1m35s

This commit is contained in:
Torsten Schulz (local)
2026-04-14 07:50:56 +02:00
parent 6e931c1069
commit b0ee0da722
3 changed files with 47 additions and 0 deletions

View File

@@ -3886,6 +3886,16 @@ pub const QUERY_INSERT_CHILD_RELATION_LOVER: &str = r#"
);
"#;
/// Realismus-Regel: pro Mutter maximal eine Geburt pro Kalendertag.
pub const QUERY_HAS_MOTHER_BIRTH_TODAY: &str = r#"
SELECT EXISTS (
SELECT 1
FROM falukant_data.child_relation cr
WHERE cr.mother_character_id = $1::int
AND cr.created_at::date = CURRENT_DATE
) AS has_birth_today;
"#;
// --- Produktionszertifikat (Daemon Daily, Spec: Produktionszertifikate) ---
/// Ein Spielercharakter pro Falukant-User (bei mehreren lebenden: **höchste** `character.id`,