[Mpuls-commits] r71 - in trunk/waskaweb: lib model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Aug 13 16:19:45 CEST 2008


Author: torsten
Date: 2008-08-13 16:19:45 +0200 (Wed, 13 Aug 2008)
New Revision: 71

Modified:
   trunk/waskaweb/lib/evaluation.py
   trunk/waskaweb/model/logbook.py
Log:
Added fix for labeling CSV exports of effort evaluation


Modified: trunk/waskaweb/lib/evaluation.py
===================================================================
--- trunk/waskaweb/lib/evaluation.py	2008-08-13 13:20:27 UTC (rev 70)
+++ trunk/waskaweb/lib/evaluation.py	2008-08-13 14:19:45 UTC (rev 71)
@@ -814,7 +814,8 @@
     """Zeitaufwände aus dem Logbuch abgeschlossene Beratungsfälle"""
     def __init__(self, compressed_ids):
         Evaluation.__init__(self, compressed_ids)
-        self.export_label = _('cm_eval_header_effort')
+        self.export_label = _('cm_eval_header_effort') 
+        self.export_eval_what = u"abgeschlossene Beratungsfälle"
         self.sql  = """SELECT sum(l.dauer) AS dauer, count(l.dauer) AS anzahl, l.art 
             FROM ka_logbuch_tbl_view l
             JOIN master_tbl_eval_total_view m
@@ -909,7 +910,7 @@
 
     def doExport(self, f):
         p = self.perform()
-        f.write(u"#%s - %s Fälle (Auswertung: Abgeschlossene Beratung)\r\n" % (self.export_label, p['avg_all'][0]))
+        f.write(u"#%s - %s Fälle (Auswertung: %s)\r\n" % (self.export_label, p['avg_all'][0], self.export_eval_what))
         f.write(u"Aktivität;Anzahl;Dauer\r\n")
         items = ['sum_cat1','1','2','3','4','9','10','sum_cat2','5','6','7','8','-1','-2','sum_all']
         for key in items:
@@ -921,6 +922,7 @@
     def __init__(self, compressed_ids):
         Evaluation_14.__init__(self, compressed_ids)
         self.export_label = _('cm_eval_header_effort2')
+        self.export_eval_what = u"abgeschlossene CM-Fälle"
         self.sql  = """SELECT sum(l.dauer) AS dauer, count(l.dauer) AS anzahl, l.art 
             FROM ka_logbuch_tbl_view l
             JOIN master_tbl_eval_incm_view m
@@ -937,10 +939,11 @@
     def __init__(self, compressed_ids):
         Evaluation_14.__init__(self, compressed_ids)
         self.export_label = _('cm_eval_header_avg_effort')
+        self.export_eval_what = u"abgeschlossene Beratungsfälle"
 
     def doExport(self, f):
         p = self.perform()
-        f.write(u"#%s - %s Fälle (Auswertung: Abgeschlossene Beratung)\r\n" % (self.export_label, p['avg_all'][0]))
+        f.write(u"#%s - %s Fälle (Auswertung: %s)\r\n" % (self.export_label, p['avg_all'][0], self.export_eval_what))
         f.write(u"Aktivität;Durchschnitt Aufwand\r\n")
         items = ['avg_cat1','avg_cat2','avg_cat3','avg_cat4','avg_all']
         for key in items:
@@ -948,10 +951,27 @@
             f.write("%s;%s\r\n" % (AVGKIND2TEXT.get(key), v[1]))
 
 class Evaluation_17(Evaluation_15):
-    """Durchschnitt Zeitaufwand abgeschlossene Beratung"""
+    """Durchschnitt Zeitaufwand abgeschlossene CM-Fälle"""
     def __init__(self, compressed_ids):
         Evaluation_15.__init__(self, compressed_ids)
         self.export_label = _('cm_eval_header_avg_effort2')
+        self.export_eval_what = u"abgeschlossene CM-Fälle"
 
+class Evaluation_18(Evaluation_14):
+    """Zeitaufwände aus dem Logbuch aller Fälle"""
+    def __init__(self, compressed_ids):
+        Evaluation.__init__(self, compressed_ids)
+        self.export_label = _('cm_eval_header_effort')
+        self.export_eval_what = u"alle Jugendliche"
+        self.sql  = """SELECT sum(l.dauer) AS dauer, count(l.dauer) AS anzahl, l.art 
+            FROM ka_logbuch_tbl_view l
+            JOIN master_tbl_eval_total_view m
+            ON m.id = l.master_id
+            WHERE %s 
+            AND l.dauer IS NOT NULL 
+            GROUP BY l.art 
+            ORDER BY l.art
+        """ % self.where_clause(self.compressed_ids, "l.master_id")
 
+
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

Modified: trunk/waskaweb/model/logbook.py
===================================================================
--- trunk/waskaweb/model/logbook.py	2008-08-13 13:20:27 UTC (rev 70)
+++ trunk/waskaweb/model/logbook.py	2008-08-13 14:19:45 UTC (rev 71)
@@ -290,9 +290,9 @@
 
     def getEvaluation(self):
         # Build casebundle with on single case
-        from waskaweb.lib.evaluation import Evaluation_14
+        from waskaweb.lib.evaluation import Evaluation_18
         cb = CaseBundle([self.mid])
-        eval = Evaluation_14(range_compress(cb.listDatasetIds()))
+        eval = Evaluation_18(range_compress(cb.listDatasetIds()))
         return eval.perform()
 
 class LogbookEntryChecker:



More information about the Mpuls-commits mailing list