[Mpuls-commits] r4185 - in base/trunk: . mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Nov 16 11:31:04 CET 2010


Author: bh
Date: 2010-11-16 11:31:03 +0100 (Tue, 16 Nov 2010)
New Revision: 4185

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/evaluate.py
Log:
* mpulsweb/controllers/evaluate.py
(EvaluateController._get_evalparams): Collect all subclauses of
the where clause in a list to make it easier to add new clauses.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-11-16 10:30:50 UTC (rev 4184)
+++ base/trunk/ChangeLog	2010-11-16 10:31:03 UTC (rev 4185)
@@ -1,3 +1,9 @@
+2010-11-16  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/controllers/evaluate.py
+	(EvaluateController._get_evalparams): Collect all subclauses of
+	the where clause in a list to make it easier to add new clauses.
+
 2010-11-15  Bernhard Herzog  <bh at intevation.de>
 
 	* mpulsweb/lib/search.py (CaseSearch.get_phases_dates_clause): For

Modified: base/trunk/mpulsweb/controllers/evaluate.py
===================================================================
--- base/trunk/mpulsweb/controllers/evaluate.py	2010-11-16 10:30:50 UTC (rev 4184)
+++ base/trunk/mpulsweb/controllers/evaluate.py	2010-11-16 10:31:03 UTC (rev 4185)
@@ -113,6 +113,8 @@
         params['phase'] = form_result['phase']
         params['ending'] = form_result['type_ending']
 
+        where_clauses = []
+
         # Dates
         # Build timeframes bases on selected phases.
         dates = []
@@ -143,15 +145,19 @@
             dates.append("TRUE")
         dates.append(' )')
 
+        where_clauses.append("".join(dates))
+
         selected_ids = "TRUE"
         if form_result.get("selected_ids"):
             selected_ids = ("(m.id in (%s))"
                             % (",".join(map(str, form_result["selected_ids"]))))
 
+        where_clauses.append(selected_ids)
+
         params['sql'] = ("SELECT %%(fields)s from master_tbl_eval_total_view m"
-                         " WHERE %s " % (" AND ".join(("".join(dates),
-                                                       selected_ids))))
+                         " WHERE %s " % (" AND ".join(where_clauses)))
 
+
         #Datefields
         if all_phases:
             params['start_date_field'] = get_phase_dates(min(all_phases))[0]



More information about the Mpuls-commits mailing list