[Mpuls-commits] r4468 - base/trunk/mpulsweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Dec 29 15:03:09 CET 2010
Author: torsten
Date: 2010-12-29 15:03:08 +0100 (Wed, 29 Dec 2010)
New Revision: 4468
Modified:
base/trunk/mpulsweb/controllers/evaluate.py
Log:
* mpulsweb/controllers/evaluate.py (EvaluateController._get_evalparams): Build sql clause for evaluation
based on selected ids and specific sql-subquery if present.
Modified: base/trunk/mpulsweb/controllers/evaluate.py
===================================================================
--- base/trunk/mpulsweb/controllers/evaluate.py 2010-12-29 13:58:37 UTC (rev 4467)
+++ base/trunk/mpulsweb/controllers/evaluate.py 2010-12-29 14:03:08 UTC (rev 4468)
@@ -48,11 +48,12 @@
return sdate, edate
-def get_search_options(soptions=None, id=None, selected_ids=(), id_field=None):
+def get_search_options(soptions=None, id=None, selected_ids=(), id_field=None, sql_where=None):
options = {}
options['id'] = id
options["selected_ids"] = " ".join(map(unicode, selected_ids))
options["id_field"] = id_field
+ options["sql_where"] = sql_where
options['typelist'] = c.evalconfig.get_evaluations()
# set default evaluation options.
@@ -84,6 +85,8 @@
del session['evaluation_ids']
if session.has_key("id_field"):
del session['id_field']
+ if session.has_key("sql_where"):
+ del session['sql_where']
session.save()
return self.evaluate(id)
@@ -92,7 +95,8 @@
None, None, None, None, None)
evaloptions = get_search_options(session.get('evaluation.options'), id,
session.get("evaluation_ids",()),
- session.get("id_field"))
+ session.get("id_field"),
+ session.get("sql_where"))
# If user selects adele-evaluation render page with disabled
# configuration elements. Change default params
@@ -158,11 +162,14 @@
selected_ids = ("(%s in (%s))"
% (id_field, ",".join(map(str, form_result["selected_ids"]))))
+ if form_result.get("sql_where"):
+ where_clauses.append(form_result.get("sql_where"))
+
where_clauses.append(selected_ids)
where_clauses.append(self.type_ending_clause(params))
- params['sql'] = ("SELECT %%(fields)s from master_tbl_eval_total_view m"
+ params['sql'] = ("SELECT %%(fields)s from master_tbl_eval_total_view m JOIN ka_status_tbl_view st on st.master_id = m.id"
" WHERE %s " % (" AND ".join(where_clauses)))
More information about the Mpuls-commits
mailing list