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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Sep 24 10:08:03 CEST 2008


Author: torsten
Date: 2008-09-24 10:08:00 +0200 (Wed, 24 Sep 2008)
New Revision: 190

Modified:
   waska/trunk/ChangeLog.txt
   waska/trunk/waskaweb/controllers/evaluate.py
   waska/trunk/waskaweb/lib/evaluation.py
   waska/trunk/waskaweb/templates/casemanagement/evaluation/evaluation_result_2.mako
Log:
Added new evaluation for ESF-Stammblatt. Fix for issue572


Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt	2008-09-23 11:14:34 UTC (rev 189)
+++ waska/trunk/ChangeLog.txt	2008-09-24 08:08:00 UTC (rev 190)
@@ -1,3 +1,13 @@
+2008-09-24	Torsten Irlaender  <torsten.irlaender at intevation.de>
+
+	Added new evaluation for ESF-Stammblatt. Fix for issue572
+
+	* waskaweb/controllers/evaluate.py,
+	  waskaweb/lib/evaluation.py,
+	  waskaweb/templates/casemanagement/evaluation/evaluation_result_2.mako:
+	  New evaluations are currentely commented out, as they need some
+	  work.
+
 2008-09-23	Torsten Irlaender  <torsten.irlaender at intevation.de>
 
 	Added two new evaluations

Modified: waska/trunk/waskaweb/controllers/evaluate.py
===================================================================
--- waska/trunk/waskaweb/controllers/evaluate.py	2008-09-23 11:14:34 UTC (rev 189)
+++ waska/trunk/waskaweb/controllers/evaluate.py	2008-09-24 08:08:00 UTC (rev 190)
@@ -203,6 +203,9 @@
                 # Nicht-Erwerbspersonen
                 e20 = Evaluation_20(self._getCompressedIds(reset))
                 c.eval_20 = e20.perform()
+                # ESF-Stammblatt 
+                #e21 = Evaluation_21(self._getCompressedIds(reset))
+                #c.eval_21 = e21.perform()
                 page = render('casemanagement/evaluation/evaluation_result_2.mako')
             elif id == '3':
                 # Vermittlung
@@ -407,4 +410,13 @@
             traceback.print_exc(file=sys.stderr)
             raise HTTPNotFound()
 
+    @checkRole(('admin_ka', 'cm_ka', 'pt_dlr', 'pb_ka'))
+    def exportEvaluation_21(self):
+        try:
+            e = Evaluation_21(self._getCompressedIds())
+            return self._export(e)
+        except:
+            traceback.print_exc(file=sys.stderr)
+            raise HTTPNotFound()
+
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

Modified: waska/trunk/waskaweb/lib/evaluation.py
===================================================================
--- waska/trunk/waskaweb/lib/evaluation.py	2008-09-23 11:14:34 UTC (rev 189)
+++ waska/trunk/waskaweb/lib/evaluation.py	2008-09-24 08:08:00 UTC (rev 190)
@@ -62,7 +62,7 @@
                 self.total_valid = c1.fetchone()[0]
 
                 # All "beratungsfälle" (valid)
-                c1.execute("""SELECT count(id) from master_tbl_eval_total_view m WHERE phase IN (0,1,6,7) AND %s""" % self.where_clause(self.compressed_ids))
+                c1.execute("""SELECT count(id) from master_tbl_eval_total_view m WHERE phase IN (-1,0,1,6,7) AND %s""" % self.where_clause(self.compressed_ids))
                 self.total_valid_beratung = c1.fetchone()[0]
 
                 # All "cm-fälle" (valid)
@@ -725,7 +725,7 @@
             if anz_vz > 0:
                 avg_month_vz = "%s" % h.formatNumber(float(months_vz) / float(anz_vz))
 
-        result = [avg_month_abg, avg_month_vz, avg_month_abr]
+        result = [avg_month_abg, anz_abg, avg_month_vz, anz_vz, avg_month_abr, anz_abr]
         return result
 
     def doExport(self, f):
@@ -734,7 +734,7 @@
         f.write(u"#%s (Auswertung: Jugendliche im CM)\r\n" % _('cm_eval_avg_length_cm'))
         f.write("Durchschnitt Monat Abgeschlossen;Durchschnitt Monat vorzeitig Abgeschlossen;Durchschnitt Monat Abgebrochen\r\n")
         for v in [p]:
-            f.write(u"%s;%s;\r\n" % (v[0], v[1]))
+            f.write(u"%s;%s;%s\r\n" % (v[0], v[2], v[4]))
 
 class Evaluation_11(Evaluation):
     """Schulabschluss beim Zugang"""
@@ -1110,5 +1110,55 @@
             for k, v in l.iteritems():
                 f.write(u"%s;%s;%s;\r\n" % (k, v[0], v[1]))
 
+class Evaluation_21(Evaluation):
+    """Auswertung des ESF Stammblatt"""
+    def __init__(self, compressed_ids):
+        Evaluation.__init__(self, compressed_ids)
+        self.eval_alter = Evaluation_8(compressed_ids)
+        self.austritte = Evaluation_13(compressed_ids)
+        self.arbeitslos = Evaluation_19(compressed_ids)
+        self.nichterwerb = Evaluation_20(compressed_ids)
+        self.migration = Evaluation_3(compressed_ids)
+        self.abschluss = Evaluation_11(compressed_ids)
 
+        # Anzahl aller Nicht-Erwerbspersonen
+
+    def perform(self):
+        # result [gesamt_anz, gesamt_proz, schule_anz, schule_proz]
+        result = {'eintritte':[0,0],'eintritte_alter':[], 'migrationshintergrund': [0,0], 'arbeitslos':{}, 'nichterwerb': {}, 'austritte': [0,0,0,0] }
+        try:
+            # eintritte gesammt
+            result_eval_alter = self.eval_alter.perform()
+            for cat in result_eval_alter:
+                result['eintritte'][0] += cat[1]
+            # eintritte nach alter aufgeschluesselt
+            result['eintritte_alter'] = result_eval_alter
+            # migrationshintergrund
+            migration = self.migration.perform() 
+            result['migrationshintergrund'][0] = migration[0][0]
+            # arbeitslos
+            result['arbeitslos'] = self.arbeitslos.perform()
+            # nichterwerb
+            result['nichterwerb'] = self.nichterwerb.perform()
+            # Austritte
+            austritte = self.austritte.perform()
+            result['austritte'][1] = austritte[1]
+            result['austritte'][2] = austritte[3]
+            result['austritte'][3] = austritte[5]
+            result['austritte'][0] = austritte[1]+austritte[3]+austritte[5]
+
+            return result
+        except StandardError, e:
+            traceback.print_exc(file=sys.stderr)
+            print >> sys.stderr, "No results for eval 21"
+
+    def doExport(self, f):
+        p = self.perform()
+
+        f.write(u"#%s (Auswertung: Jugendliche im CM)\r\n" % _('cm_eval_summary_header_21'))
+        f.write("Kategorie;Anzahl;Prozent\r\n")
+        for l in [p]:
+            for k, v in l.iteritems():
+                f.write(u"%s;%s;%s;\r\n" % (k, v[0], v[1]))
+
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

Modified: waska/trunk/waskaweb/templates/casemanagement/evaluation/evaluation_result_2.mako
===================================================================
--- waska/trunk/waskaweb/templates/casemanagement/evaluation/evaluation_result_2.mako	2008-09-23 11:14:34 UTC (rev 189)
+++ waska/trunk/waskaweb/templates/casemanagement/evaluation/evaluation_result_2.mako	2008-09-24 08:08:00 UTC (rev 190)
@@ -53,15 +53,15 @@
    % if idset==0:
    <tr>
     <td>${r[0]| F.NA, h}</td>
-    <td>${r[1]| F.NA, h}</td>
     <td>${r[2]| F.NA, h}</td>
+    <td>${r[4]| F.NA, h}</td>
   </tr>
   <% idset = 1 %>
   % else:
    <tr>
      <td class="table_row_v_12">${r[0]| F.NA, h}</td>
-     <td class="table_row_v_12">${r[1]| F.NA, h}</td>
      <td class="table_row_v_12">${r[2]| F.NA, h}</td>
+     <td class="table_row_v_12">${r[4]| F.NA, h}</td>
    </tr>
   <% idset = 0 %>
   % endif
@@ -258,3 +258,6 @@
 </table>
 <a href="#top">${_('cm_eval_table_to_overview')}</a> | <a href="/evaluate/exportEvaluation_20/auswertung_2_6.csv">${_('cm_eval_table_export_analysis')}</a>
 </div>
+##<div class="evaluation even-row">
+##  <%include file="/casemanagement/evaluation/evaluation_esfstammblatt.mako"/>
+##</div>



More information about the Mpuls-commits mailing list