[Mpuls-commits] r856 - wasko/branches/2.0/waskaweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jan 26 09:56:35 CET 2010


Author: torsten
Date: 2010-01-26 09:56:34 +0100 (Tue, 26 Jan 2010)
New Revision: 856

Modified:
   wasko/branches/2.0/waskaweb/lib/search.py
Log:
* waskaweb/lib/search.py (AgencySearch): Removed. Not used anywhere.
* waskaweb/lib/search.py: Removed SQL for AgencySearch.



Modified: wasko/branches/2.0/waskaweb/lib/search.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/search.py	2010-01-26 08:50:57 UTC (rev 855)
+++ wasko/branches/2.0/waskaweb/lib/search.py	2010-01-26 08:56:34 UTC (rev 856)
@@ -81,21 +81,9 @@
       AND %s
     ORDER BY %s %s"""
 
+# FIXME: This should be better a config var
 INCONSISTENCY_CHECK_AFTER = '2008-08-31'
 
-SEARCH_AGENCY_SQL = \
-"""select count(m.id) as anzahl,
-m.fkz,
-date_trunc('minute', max(s.zugriff)) as zugriff
-from master_tbl_view m 
-join ka_status_tbl_view s 
-on m.id = s.master_id
-WHERE %s
-AND %s
-AND %s
-group by fkz
-ORDER BY %s %s"""
-
 class Search:
     def __init__(self):
         pass
@@ -161,42 +149,6 @@
         result = self.queryDB(sql, fields)
         return result
 
-class AgencySearch(Search):
-    def __init__(self):
-        Search.__init__(self)
-
-    def _build_sql(self, search, options, allowed_states, bad_types, phaseslist, fieldsdic):
-        fields = {'needle': ""}
-        gender = options.get('gender') and "m.geschlecht = %s" % options.get('gender') or "TRUE"
-
-        #Phases
-        phases = 'TRUE' #default
-        if phaseslist:
-            phases = 'm.id in (SELECT id from master_tbl_view WHERE phase in (%s))' % ','.join([str(p) for p in phaseslist])
-
-        time_interval = "TRUE"
-        interval_start_field = options.get('interval_start_field', "erstgespraech")
-        interval_end_field = options.get('interval_end_field', "datum_cm_ende")
-        interval_start_date = options.get('interval_start_date',"1970-01-01")
-        d = datetime.today()
-        interval_end_date = options.get('interval_end_date', d.strftime('%Y-%m-%d'))
-        fields = {'start_field': interval_start_field, 'start_date': interval_start_date, 'end_field': interval_end_field, 'end_date': interval_end_date} 
-        if interval_start_date != '1970-01-01':
-            time_interval = "(coalesce(%(start_field)s, '1970-01-01')::date <= '%(end_date)s'::date \
-            AND (coalesce(%(end_field)s, now()) >= '%(start_date)s'::date))" % fields
-
-            #time_interval = "(coalesce(%(start_field)s, '1970-01-01'::date) <= '%(end_date)s'::date AND \
-            #coalesce(%(start_field)s, '1970-01-01'::date) <= coalesce(%(end_field)s, st.zugriff) AND \
-            #((m.id in (SELECT id from master_tbl_incm_view) AND \
-            #(coalesce(%(end_field)s, now()) >= '%(start_date)s'::date)) OR \
-            #(st.zugriff >= '%(start_date)s'::date)))" % fields
-
-        sort_field = options.get('sort_field', "name")
-        sort_order       = options.get('sort_order', "desc")
-        fields['needle'] = " ".join(search) 
-        SQL = SEARCH_AGENCY_SQL % (gender, time_interval, phases, sort_field, sort_order) 
-        return (SQL, fields)
-
 class CaseSearch(Search):
     def __init__(self):
         Search.__init__(self)



More information about the Mpuls-commits mailing list