[Mpuls-commits] r724 - waska/trunk/waskaweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Dec 4 14:45:48 CET 2009
Author: torsten
Date: 2009-12-04 14:45:48 +0100 (Fri, 04 Dec 2009)
New Revision: 724
Modified:
waska/trunk/waskaweb/controllers/evaluate.py
Log:
Fixed search in evaluation
Modified: waska/trunk/waskaweb/controllers/evaluate.py
===================================================================
--- waska/trunk/waskaweb/controllers/evaluate.py 2009-12-04 13:43:16 UTC (rev 723)
+++ waska/trunk/waskaweb/controllers/evaluate.py 2009-12-04 13:45:48 UTC (rev 724)
@@ -3,6 +3,7 @@
import formencode
import traceback
import pylons
+import datetime
from pylons import session, g, c
from waskaweb.lib.validators import EvaluationFormValidator
@@ -55,9 +56,12 @@
options['typelist'] = c.evalconfig.get_evaluations()
phases = []
- for p in g.mpuls_config.get('search', 'phases'):
- pt = [t for t in p.values() if int(t) >= 0]
- phases.extend(pt)
+ if soptions:
+ phases = soptions.get('phase', [])
+ else:
+ for p in g.mpuls_config.get('search', 'phases'):
+ pt = [t for t in p.values() if int(t) >= 0]
+ phases.extend(pt)
options['phase'] = phases
# convert dates to locale
@@ -132,7 +136,7 @@
sdf = g.mpuls_config.get('agency-fields-mapping', 'date_phase%s_start' % p)
edf = g.mpuls_config.get('agency-fields-mapping', 'date_phase%s_end' % p)
suc = get_phasesuccessors(p)
- all_phases.extend(suc)
+ all_phases.append(int(p))
tdates.append("('%s'::date <= %s AND '%s'::date >= %s AND phase IN (%s) )" % (params.get('start_date'), edf, params.get('end_date'), sdf, ",".join(["%s" % s for s in suc])))
else:
tdates.append('phase IN (-1)')
@@ -157,7 +161,7 @@
#Datefields
if all_phases:
params['start_date_field'] = g.mpuls_config.get('agency-fields-mapping', 'date_phase%s_start' % min(all_phases))
- params['end_date_field'] = g.mpuls_config.get('agency-fields-mapping', 'date_phase%s_start' % max(all_phases))
+ params['end_date_field'] = g.mpuls_config.get('agency-fields-mapping', 'date_phase%s_end' % max(all_phases))
else:
params['start_date_field'] = g.mpuls_config.get('evaluations', 'default-start-date-field')
params['end_date_field'] = g.mpuls_config.get('evaluations', 'default-end-date-field')
More information about the Mpuls-commits
mailing list