From 46f3e814b20bd20696dfe9e83e1726aeec170007 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 28 Apr 2015 11:01:03 +0200 Subject: [PATCH] fireinfo: Let get_profile() return only valid profiles --- webapp/backend/fireinfo.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/webapp/backend/fireinfo.py b/webapp/backend/fireinfo.py index b4b74248..3f4be977 100644 --- a/webapp/backend/fireinfo.py +++ b/webapp/backend/fireinfo.py @@ -1496,10 +1496,9 @@ class Fireinfo(Object): res = self.db.get("SELECT * FROM fireinfo_profiles \ WHERE public_id = %s AND \ (CASE WHEN %s IS NULL THEN TRUE ELSE private_id = %s END) AND \ - (CASE WHEN %s IS NULL THEN TRUE ELSE \ - then_or_now(%s) BETWEEN time_created AND time_valid END) \ - ORDER BY time_updated DESC LIMIT 1", public_id, - private_id, private_id, when, when) + then_or_now(%s) BETWEEN time_created AND time_valid \ + ORDER BY time_updated DESC LIMIT 1", + public_id, private_id, private_id, when) if res: return Profile(self.backend, res.id, res) -- 2.47.3