[Mpuls-commits] r2071 - wasko/branches/2.0/mpulsweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Mar 23 12:34:41 CET 2010
Author: torsten
Date: 2010-03-23 12:34:39 +0100 (Tue, 23 Mar 2010)
New Revision: 2071
Modified:
wasko/branches/2.0/mpulsweb/model/appointment.py
Log:
* mpulsweb/model/appointment.py (MaxSaveTimeReminderOverview): Fixed
sql-statements.
Modified: wasko/branches/2.0/mpulsweb/model/appointment.py
===================================================================
--- wasko/branches/2.0/mpulsweb/model/appointment.py 2010-03-23 11:32:53 UTC (rev 2070)
+++ wasko/branches/2.0/mpulsweb/model/appointment.py 2010-03-23 11:34:39 UTC (rev 2071)
@@ -115,35 +115,35 @@
SELECT m.id, s.zugriff, getLastCaseAppointment(m.id) AS last_date
FROM
(SELECT * FROM ka_status_tbl_view
- WHERE zugriff < now() - interval '1 day' * %(maxdays)s AND status <> 5) s
+ WHERE zugriff < now() - interval '1 day' * %%(maxdays)s AND status <> 5) s
JOIN master_tbl_view m ON m.id = s.master_id
-WHERE phase::varchar in (%(phases)s)
+WHERE phase in (%s)
"""
GET_OLDACTIVE_CASES = """
SELECT m.id, s.zugriff, getLastCaseAppointment(m.id) AS last_date
FROM
(SELECT * FROM ka_status_tbl_view
- WHERE zugriff < now() - interval '1 day' * %(maxdays)s AND status <> 5) s
+ WHERE zugriff < now() - interval '1 day' * %%(maxdays)s AND status <> 5) s
JOIN master_tbl_view m ON m.id = s.master_id
-WHERE phase::varchar in (%(phases)s) AND m.bearbeiter_id = %(editor)s
+WHERE phase in (%s) AND m.bearbeiter_id = %%(editor)s
"""
GET_OLDFINISHED_CASES_4_ADMIN = """\
SELECT m.id, s.zugriff, getLastCaseAppointment(m.id) as last_date
FROM master_tbl_view m JOIN ka_status_tbl_view s ON s.master_id = m.id
WHERE s.status <> 5
- AND extract(day from now()-s.zugriff) > %(maxdays)s
- AND phase::varchar in (%(phases)s)
+ AND extract(day from now()-s.zugriff) > %%(maxdays)s
+ AND phase in (%s)
"""
GET_OLDFINISHED_CASES = """\
SELECT m.id, s.zugriff, getLastCaseAppointment(m.id) as last_date
FROM master_tbl_view m JOIN ka_status_tbl_view s ON s.master_id = m.id
WHERE s.status <> 5
- AND m.bearbeiter_id = %(editor)s
- AND extract(day from now()-s.zugriff) > %(maxdays)s
- AND phase::varchar in (%(phases)s)
+ AND m.bearbeiter_id = %%(editor)s
+ AND extract(day from now()-s.zugriff) > %%(maxdays)s
+ AND phase in (%s)
"""
log = logging.getLogger(__name__)
@@ -495,15 +495,16 @@
conn = db.getConnection()
cur = conn.cursor()
if user.isAdmin():
- cur.execute(GET_OLDFINISHED_CASES_4_ADMIN,
- {'maxdays': days,
- 'phases': ",".join(g.mpuls_config.get('phases', 'finished'))})
+ sql = GET_OLDFINISHED_CASES_4_ADMIN % \
+ ",".join(g.mpuls_config.get('phases', 'finished'))
+ cur.execute(sql,
+ {'maxdays': days})
else:
- cur.execute(GET_OLDFINISHED_CASES,
+ sql = GET_OLDFINISHED_CASES % \
+ ",".join(g.mpuls_config.get('phases', 'finished'))
+ cur.execute(sql,
{'maxdays': days,
- 'editor': user.id,
- 'phases': ",".join(g.mpuls_config.get('phases', 'finished'))})
-
+ 'editor': user.id})
result = cur.fetchall()
for r in result:
list[r[0]] = {'access':r[1], 'last_date': r[2]}
@@ -519,15 +520,15 @@
conn = db.getConnection()
cur = conn.cursor()
if user.isAdmin():
- cur.execute(GET_OLDACTIVE_CASES_4_ADMIN,
+ sql = GET_OLDACTIVE_CASES_4_ADMIN % ",".join(g.mpuls_config.get('phases', 'active'))
+ cur.execute(sql,
{'maxdays': days,
- 'editor': user.id,
- 'phases': ",".join(g.mpuls_config.get('phases', 'active'))})
+ 'editor': user.id})
else:
- cur.execute(GET_OLDACTIVE_CASES,
+ sql = GET_OLDACTIVE_CASES % ",".join(g.mpuls_config.get('phases', 'active'))
+ cur.execute(sql,
{'maxdays': days,
- 'editor': user.id,
- 'phases': ",".join(g.mpuls_config.get('phases', 'active'))})
+ 'editor': user.id})
result = cur.fetchall()
for r in result:
list[r[0]] = {'access':r[1], 'last_date': r[2]}
More information about the Mpuls-commits
mailing list