[Mpuls-commits] r5523 - base/trunk/mpulsweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Nov 2 15:57:36 CET 2011
Author: roland
Date: 2011-11-02 15:57:36 +0100 (Wed, 02 Nov 2011)
New Revision: 5523
Modified:
base/trunk/mpulsweb/controllers/evaluate.py
Log:
issue2149: Show the selected Phases and Case/Agency IDs from the evaluation
Modified: base/trunk/mpulsweb/controllers/evaluate.py
===================================================================
--- base/trunk/mpulsweb/controllers/evaluate.py 2011-11-02 14:15:06 UTC (rev 5522)
+++ base/trunk/mpulsweb/controllers/evaluate.py 2011-11-02 14:57:36 UTC (rev 5523)
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
import os
import logging
import formencode
@@ -96,7 +97,32 @@
return options
+def get_phase_filter_for_evaluation(eval_phases):
+ """Helper function to get more human readable forms of the phase filter for
+ the evaluations. """
+
+ if eval_phases:
+ phases = PhaseFactory().build()
+ selected_phases = [phase.getDescription() for phase in phases \
+ if phase.id in eval_phases]
+ selected_phases = ', '.join(selected_phases)
+ else:
+ selected_phases = 'keine'
+
+ return selected_phases
+
+def get_id_filter_for_evaluation(eval_ids):
+ """Helper function to get more human readable forms of the id filter for
+ the evaluations. """
+
+ if eval_ids:
+ selected_ids = eval_ids.replace(' ', ', ')
+ else:
+ selected_ids = 'keine'
+
+ return selected_ids
+
class EvaluateController(BaseController):
def index(self):
@@ -291,6 +317,15 @@
None,
eval_params['sql'],
eval_params['typelist'])
+
+
+ # Massage the filter to make it human readable
+ selected_phases = get_phase_filter_for_evaluation(params.get('phase'))
+ selected_ids = get_id_filter_for_evaluation(params.get('selected_ids'))
+
+ evalconfig.set_filter({"phases": selected_phases,
+ "items": selected_ids}) # Cases or agencies
+
# Set second parameter to True to enable debugging
evalset = EvaluationSet(evalconfig)
evalset.evaluate()
@@ -338,6 +373,15 @@
None,
params['sql'],
params['typelist'])
+
+ # Massage the filter to make it human readable
+ selected_phases = get_phase_filter_for_evaluation(params.get('phase'))
+ selected_ids = get_id_filter_for_evaluation(params.get('selected_ids'))
+
+ evalconfig.set_filter({"phases": selected_phases,
+ "items": selected_ids}) # Cases or agencies
+
+ # Set second parameter to True to enable debugging
evalset = EvaluationSet(evalconfig)
evalset.evaluate()
return evalset.export(export_class())
More information about the Mpuls-commits
mailing list