Fixed: Query getAll in Ampel Class

Query was not retrieving correctly active Ampeln.
Adapted time conditions.
This commit is contained in:
Cris
2020-04-28 16:24:30 +02:00
parent a37b81c57a
commit 9f42beaeb3
+6 -2
View File
@@ -129,8 +129,12 @@ class ampel extends basis_db
$qry = "SELECT *,".$beschreibung.", ".$buttontext." FROM public.tbl_ampel";
if($aktiv)
{
$qry .= " WHERE (NOW()>(deadline-(vorlaufzeit || ' days')::interval)::date)";
$qry .= " AND (NOW()<(deadline+(verfallszeit || ' days')::interval)::date)";
// (ab sofort ODER innerhalb der Vorlaufzeit)
$qry .= " WHERE (vorlaufzeit IS NULL OR (NOW()>(deadline -(vorlaufzeit || ' days')::interval)::date))";
// UND (nicht abgelaufen...
$qry .= " AND ((NOW()<(deadline+(verfallszeit || ' days')::interval)::date)";
// ...ODER ohne Verfallszeit)
$qry .= " OR verfallszeit IS NULL)";
}
$qry .= " ORDER BY deadline";