Füge Logik zur Durchsetzung der Wahlvorlaufzeit hinzu: Implementiere die Funktion enforce_election_lead_time, um sicherzustellen, dass Wahlen erst nach Ablauf von 2 Tagen seit ihrer Erstellung ausgewertet werden. Aktualisiere SQL-Abfragen zur Berücksichtigung des Vorlaufs bei der Planung neuer Wahlen.
All checks were successful
Deploy yourpart (blue-green) / deploy (push) Successful in 1m41s
All checks were successful
Deploy yourpart (blue-green) / deploy (push) Successful in 1m41s
This commit is contained in:
@@ -1113,7 +1113,7 @@ pub const QUERY_FIND_OFFICE_GAPS: &str = r#"
|
||||
pub const QUERY_SELECT_NEEDED_ELECTIONS: &str = r#"
|
||||
WITH
|
||||
target_date AS (
|
||||
SELECT NOW()::date AS election_date
|
||||
SELECT (NOW()::date + INTERVAL '2 days')::date AS election_date
|
||||
),
|
||||
offices_ending_today AS (
|
||||
SELECT po.id,
|
||||
@@ -1186,6 +1186,14 @@ pub const QUERY_SELECT_NEEDED_ELECTIONS: &str = r#"
|
||||
ORDER BY ne.region_id, ne.election_id;
|
||||
"#;
|
||||
|
||||
pub const QUERY_ENFORCE_ELECTION_LEAD_TIME: &str = r#"
|
||||
UPDATE falukant_data.election AS e
|
||||
SET date = (e.created_at::date + INTERVAL '2 days')::date,
|
||||
updated_at = NOW()
|
||||
WHERE e.created_at IS NOT NULL
|
||||
AND e.date::date < (e.created_at::date + INTERVAL '2 days')::date;
|
||||
"#;
|
||||
|
||||
pub const QUERY_INSERT_CANDIDATES: &str = r#"
|
||||
INSERT INTO falukant_data.candidate
|
||||
(election_id, character_id, created_at, updated_at)
|
||||
|
||||
Reference in New Issue
Block a user