[Mpuls-commits] r501 - in waska/trunk: . waskaweb/controllers waskaweb/lib waskaweb/templates/casemanagement/evaluation

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed May 6 10:25:34 CEST 2009


Author: torsten
Date: 2009-05-06 10:25:33 +0200 (Wed, 06 May 2009)
New Revision: 501

Modified:
   waska/trunk/ChangeLog.txt
   waska/trunk/waskaweb/controllers/evaluate.py
   waska/trunk/waskaweb/lib/basicevaluation.py
   waska/trunk/waskaweb/templates/casemanagement/evaluation/evaluation_basic.mako
Log:
Added new evaluation for "Fortschreibung"


Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt	2009-04-27 12:30:24 UTC (rev 500)
+++ waska/trunk/ChangeLog.txt	2009-05-06 08:25:33 UTC (rev 501)
@@ -1,3 +1,12 @@
+2009-05-06	Torsten Irlaender  <torsten.irlaender at intevation.de>
+
+	Added new evaluation for "Fortschriebungsantrag"
+
+	* waskaweb/controllers/evaluate.py,
+	  waskaweb/lib/basicevaluation.py,
+	  waskaweb/templates/casemanagement/evaluation/evaluation_basic.mako:
+	  Added new template,lib and controller for evaluation
+
 2009-04-27	Torsten Irlaender  <torsten.irlaender at intevation.de>
 
 	Added new evaluation stub.

Modified: waska/trunk/waskaweb/controllers/evaluate.py
===================================================================
--- waska/trunk/waskaweb/controllers/evaluate.py	2009-04-27 12:30:24 UTC (rev 500)
+++ waska/trunk/waskaweb/controllers/evaluate.py	2009-05-06 08:25:33 UTC (rev 501)
@@ -165,17 +165,18 @@
     def evaluateBasic(self):
         params = {}
         params['start_date'] = '2008-09-01'
-        params['end_date']   = '2009-05-31'
+        params['end_date']   = '2009-04-27'
         c.select = 2
-        if request.params:
-            if request.params.get('timeframe') == '1':
-                params['start_date'] = '2008-09-01'
-                params['end_date']   = '2008-12-31'
-                c.select = 1
-            else:
-                params['start_date'] = '2009-01-01'
-                params['end_date']   = '2009-03-31'
-                c.select = 2
+        # no other timeframes available yet
+        #if request.params:
+        #    if request.params.get('timeframe') == '1':
+        #        params['start_date'] = '2008-09-01'
+        #        params['end_date']   = '2008-12-31'
+        #        c.select = 1
+        #    else:
+        #        params['start_date'] = '2009-01-01'
+        #        params['end_date']   = '2009-03-31'
+        #        c.select = 2
 
         params['agencyid']   = 'inte0002'
 

Modified: waska/trunk/waskaweb/lib/basicevaluation.py
===================================================================
--- waska/trunk/waskaweb/lib/basicevaluation.py	2009-04-27 12:30:24 UTC (rev 500)
+++ waska/trunk/waskaweb/lib/basicevaluation.py	2009-05-06 08:25:33 UTC (rev 501)
@@ -21,18 +21,21 @@
 SQL_TABLE      = "master_tbl_eval_total_view"
 SQL_GENDER_FIELD   = 'geschlecht'
 SQL_FKZ = """(TRUE)"""
+# ende
 SQL_CM = """
 -- Nur CM-Faelle
-((kompetenzfeststellung = '1' 
+-- Faelle, die vor dem Ende des BZ zum CM geworden sind 
+( coalesce(datum_feststellung, now()) <= '%s'::date) 
+and ((kompetenzfeststellung = '1' 
     or (kompetenzfeststellung = '-1' and phase in (2,3,4,5))
 ) 
 or (bereich_berufliche_qualifizierung = '1' or bereich_berufsvorbereitung = '1'
    or bildender_bereich = '1' or bereich_lebensbewaeltigung = '1' or
    sonstiger_foerderbedarf = '1'))"""
 
-# begin,ende,begin,begin,begin,ende,begin,ende,ende,begin,begin,begin,ende,begin,ende
-SQL_TIME = """TRUE"""
-SQL_TIME2 = """
+# begin,ende,begin,begin
+SQL_TIME2 = """TRUE"""
+SQL_TIME = """
 (
     --
     -- Ausfiltern der Faelle, die definitiv nicht in Frage kommen
@@ -44,46 +47,12 @@
     -- Beendigung vor BZ
     and not (coalesce(beendigung_5, now()) < '%s'::date)
     -- Begin nach BZ
-    and not (coalesce(datum_feststellung, '1970-01-01'::date) > '%s'::date)
+    and not (coalesce(erstgespraech, '1970-01-01'::date) > '%s'::date)
     -- Begin vor BZ aber auch letzte Aktualisierung vor BZ
-    and not (coalesce(datum_feststellung, '1970-01-01'::date) < '%s'::date
+    and not (coalesce(erstgespraech, '1970-01-01'::date) < '%s'::date
              and s.zugriff < '%s'::date)
-    -- Kein Begin und Erstgespraech nicht im BZ
-    and not (datum_feststellung IS NULL and (coalesce(erstgespraech,
-    '1970-01-01'::date) < '%s'::date or coalesce(erstgespraech,
-    '1970-01-01'::date) > '%s'::date)
-    )
 )
-and (
-    --
-    -- Nur Faelle die den Kriterien entsprechen 
-    --
-    -- Beendigung im BZ
-    (coalesce(beendigung_5, now()) >= '%s'::date 
-    and coalesce(beendigung_5, now()) <= '%s'::date) 
-    or (
-      -- Beendigung nach BZ
-      coalesce(beendigung_5, now()) >= '%s'::date 
-      and (
-    -- Begin vor BZ und Aktualisierung nach Begin BZ
-    (datum_feststellung < '%s'::date and s.zugriff >=
-    '%s'::date) 
-    or 
-    -- Begin im BZ
-    (datum_feststellung >= '%s'::date 
-    and datum_feststellung <= '%s'::date)
-      )
-      -- Erstgespraech innerhalb des BZ
-      or ( erstgespraech >= '%s'::date and erstgespraech <=
-      '%s'::date)
-    )
-)
 """
-# Alte Abfrage
-#SQL_TIME = """(datum_feststellung <= '%s'::date and coalesce(beendigung_5, now()) >= '%s'::date)"""
-# Für die erste Auswertung geändert. Auch alle Bestandskunden sollen zunächst
-# als Eintritte gezählt werden.Damit ist die Anzahl der CM Kunden = Eintritte.
-# SQL_EINTRITTE_GESAMT           = """('%s'::date <= datum_feststellung and '%s'::date >= datum_feststellung)"""
 SQL_GESAMT = """TRUE"""
 SQL_CMKUNDEN = SQL_CM
 
@@ -119,17 +88,13 @@
     def _build_sql(self, where):
         out = []
         try:
-            #out.append(self.sql_fkz % self.agency)
-            # begin,ende,begin,begin,begin,ende
             begin = self.start_date
             ende  = self.end_date
-            #out.append(self.sql_time_frame % (begin,ende,begin,begin,begin,ende,begin,ende,ende,begin,begin,begin,ende,begin,ende))
-            out.append(self.sql_time_frame) 
-
+            out.append(self.sql_time_frame % (begin,ende,begin,begin))
         except StandardError, err:
             print "Fehler: %s" % err
         try:
-            out.append(where % (self.start_date, self.end_date))
+            out.append(where % (self.end_date))
         except StandardError, err:
             out.append(where)
             pass # Maybe the where clause does not have any time restrictions
@@ -137,59 +102,4 @@
         sql = Evaluation._build_sql(self, where)
         return sql
 
-#class AdeleXML:
-#
-#    def perform(self, params):
-#        doknr      = params.get('doknr')
-#        start_date = params.get('start_date')
-#        end_date   = params.get('end_date')
-#        typelist   = params.get('typelist')
-#
-#        #TEST Remove for production
-#        doknr = 'JSA.02.12345.08'
-#        start_date = '2008-01-01'
-#        end_date = '2008-12-31'
-#
-#        #Do some checks on the incoming data
-#        if not doknr or not EXP_DOKNR.match(doknr): return "INVALID: 'doknr'"
-#        if not start_date or not EXP_DATE.match(start_date): return "INVALID: 'start_date'"
-#        if not end_date or not EXP_DATE.match(end_date): return "INVALID: 'end_date'"
-#        if not typelist:
-#            TYPELIST = DEFAULT_EVALUATIONS
-#        else:
-#            if not EXP_TYPE.match(typelist): return "INVALID: 'typelist'"
-#            TYPELIST = typelist.split(',')
-#
-#        #Make evaluation on the collected cases
-#        try:
-#            out = []
-#            out.append(XML_HEADER % (doknr, start_date, end_date)) 
-#            for id in TYPELIST:
-#                SQL_WHERE = EVALUATION.get(str(id), 'TRUE')
-#
-#                # If the timeinterval was not or not full provied set timeframe
-#                # to a very large interval 
-#                if not start_date or not end_date:
-#                    start_date = '1970-01-01'
-#                    end_date = '%s' % datetime.today().strftime('%Y-%m-%d') 
-#
-#                TIMEFRAME = SQL_TIME % (end_date, start_date)
-#
-#                # Try to set the dates in the where clause
-#                try:
-#                    SQL_WHERE = SQL_WHERE % (start_date, end_date)
-#                except:
-#                    pass # Ignore. Maybe the sql query does not have any
-#                         # datefields
-#
-#                sql = SQL_BASE_QUERY % (SQL_GROUPBY, SQL_TABLE, TIMEFRAME, SQL_WHERE , SQL_GROUPBY)
-#                eval = EvaluationQuery(id, sql)
-#                eval.perform()
-#                out.append(XML_EVALBLOCK % (eval.id, eval.men, eval.women, eval.men+eval.women))
-#            out.append(XML_FOOTER)
-#        except StandardError, err:
-#            log.error(err)
-#
-#        return "\n".join(out)
-
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

Modified: waska/trunk/waskaweb/templates/casemanagement/evaluation/evaluation_basic.mako
===================================================================
--- waska/trunk/waskaweb/templates/casemanagement/evaluation/evaluation_basic.mako	2009-04-27 12:30:24 UTC (rev 500)
+++ waska/trunk/waskaweb/templates/casemanagement/evaluation/evaluation_basic.mako	2009-05-06 08:25:33 UTC (rev 501)
@@ -13,7 +13,7 @@
 <p>Bitte wählen Sie den Zeitraum, für den die Auswertung durchgeführt werden soll</p>
 <p>
 <select name="timeframe">
-    <option value="1" selected>01.09.2008 - 31.05.2009</option>
+    <option value="1" selected>01.09.2008 - 27.04.2009</option>
 </select>
 <input type="submit" value="Auswerten">
 </p>



More information about the Mpuls-commits mailing list