[Mpuls-commits] r723 - wasko/branches/1.0/waskaweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Dec 4 14:43:16 CET 2009


Author: torsten
Date: 2009-12-04 14:43:16 +0100 (Fri, 04 Dec 2009)
New Revision: 723

Modified:
   wasko/branches/1.0/waskaweb/controllers/evaluate.py
Log:
Fixed evaluation


Modified: wasko/branches/1.0/waskaweb/controllers/evaluate.py
===================================================================
--- wasko/branches/1.0/waskaweb/controllers/evaluate.py	2009-12-02 09:52:59 UTC (rev 722)
+++ wasko/branches/1.0/waskaweb/controllers/evaluate.py	2009-12-04 13:43:16 UTC (rev 723)
@@ -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)')
@@ -156,7 +160,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