[Mpuls-commits] r4698 - base/trunk/mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Feb 24 16:43:39 CET 2011


Author: torsten
Date: 2011-02-24 16:43:38 +0100 (Thu, 24 Feb 2011)
New Revision: 4698

Modified:
   base/trunk/mpulsweb/lib/search.py
Log:
* mpulsweb/lib/search.py (EvaluationSearch.get_group): Fixed
	Search-Query.  bundesland_id must be present in result as it is used
	in evaluation later.


Modified: base/trunk/mpulsweb/lib/search.py
===================================================================
--- base/trunk/mpulsweb/lib/search.py	2011-02-24 09:17:50 UTC (rev 4697)
+++ base/trunk/mpulsweb/lib/search.py	2011-02-24 15:43:38 UTC (rev 4698)
@@ -513,7 +513,7 @@
     %(order)s
     """
 
-    SEARCH_FIELDS = """m.fkz as id, f.fkz, f.name, count(m.id) as count, max(m.zugriff) as time"""
+    SEARCH_FIELDS = """m.fkz as id, f.fkz, f.name, f.bundesland_id, count(m.id) as count, max(m.zugriff) as time"""
 
     VALID_OPTIONS = (Search.VALID_OPTIONS
                      + ("state", "phase", "own", "standin", "editor", "branch",
@@ -545,7 +545,7 @@
     def get_federalstate_clause(self, options):
         """Return the search condition to select cases based on federal state."""
         if options.get('federal_state'):
-            return "f.bundesland_id IN ( %s )" % ",".join([str(x) for x in options.get('federal_state')])
+            return "f.bundesland_id::integer IN ( %s )" % ",".join([str(x) for x in options.get('federal_state')])
         return "TRUE"
 
     def get_fields(self, options):
@@ -557,7 +557,7 @@
         return self.SEARCH_ORDER % (sort_field, sort_order)
 
     def get_group(self, options):
-        group_field = options.get('group_field', "f.fkz, m.fkz, f.name")
+        group_field = options.get('group_field', "f.fkz, m.fkz, f.name, f.bundesland_id")
         return self.GROUP_BY % (group_field)
 
     def _build_sql(self, options):



More information about the Mpuls-commits mailing list