[Mpuls-commits] r3831 - in waska/trunk: . waskaweb/controllers waskaweb/model waskaweb/public/formed

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Sep 30 14:43:38 CEST 2010


Author: roland
Date: 2010-09-30 14:43:37 +0200 (Thu, 30 Sep 2010)
New Revision: 3831

Added:
   waska/trunk/waskaweb/controllers/logbook.py
Modified:
   waska/trunk/ChangeLog
   waska/trunk/waskaweb/model/case.py
   waska/trunk/waskaweb/public/formed/annotations.xhtml
   waska/trunk/waskaweb/public/formed/formedtree.xml
Log:
G121: implemented locating and non locating work

Modified: waska/trunk/ChangeLog
===================================================================
--- waska/trunk/ChangeLog	2010-09-30 11:13:59 UTC (rev 3830)
+++ waska/trunk/ChangeLog	2010-09-30 12:43:37 UTC (rev 3831)
@@ -1,3 +1,10 @@
+2010-09-30 Roland Geider <roland.geider at intevation.de>
+
+	* waskaweb/model/case.py,
+	  waskaweb/controllers/logbook.py: G121: implemented locating and non
+	  locating work (aufsuchende, nicht aufsuchende Arbeit) as types in
+	  the logbook
+
 2010-09-29  Torsten Irländer <torsten.irlaender at intevation.de>
 
 	* waska.json: Issue1027: Added optional hyphen to the phasedescription.

Added: waska/trunk/waskaweb/controllers/logbook.py
===================================================================
--- waska/trunk/waskaweb/controllers/logbook.py	2010-09-30 11:13:59 UTC (rev 3830)
+++ waska/trunk/waskaweb/controllers/logbook.py	2010-09-30 12:43:37 UTC (rev 3831)
@@ -0,0 +1,119 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright 2007, 2008 Intevation GmbH, Germany, <info at intevation.de>
+# 
+# This file is part of mpuls WASKA (CoMPUter-based case fiLeS - 
+# Web-Anwendungs-Server fuer Kompetenzagenturen).
+# 
+# mpuls WASKA is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+# 
+# mpuls WASKA is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
+# License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public
+# License along with mpuls WASKA. If not, see <http://www.gnu.org/licenses/>.
+# 
+# mpuls WASKA has been developed on behalf of the 
+# Projekttraeger im Deutschen Zentrum fuer Luft- und Raumfahrt e.V. (PT-DLR)
+# within the programme Kompetenzagenturen (Durchfuehrungsphase) funded by
+# the Bundesministerium fuer Familie, Senioren, Frauen und Jugend and 
+# European Social Fund resources.
+
+import logging
+
+from mpulsweb.controllers.logbook import LogbookController, get_sort
+from mpulsweb.model.logbook import Logbook
+
+from mpulsweb.lib.base import c, render, request, session
+from mpulsweb.lib.db import db
+from mpulsweb.lib.security import checkRole
+
+log = logging.getLogger(__name__)
+
+class LogbookController(LogbookController):
+    @checkRole(('cm_ka'))
+    def index(self, id):
+        print "Updating logbook data in formed..."
+        return self.overview(id)
+
+    def overview(self, id):
+        print "Overview. Calculating..."
+        sort, order = get_sort(request.params)
+        id = self._checkInt(id)
+
+        # Load logbook
+        logbook = Logbook()
+        logbook.loadById(int(id), sort, order)
+        c.logbook = logbook
+
+        # Build evaluations
+        c.eval_effort = logbook.getEvaluation()
+        type_statistics = logbook.getTypEvaluation()
+        c.eval_typ_effort = type_statistics
+        
+        
+        # Update the case data with the evaluation statistics. Do not this if
+        # the user manually edited the fields in the form page.
+        conn, cur = None, None
+        try:
+            update_case = True
+            conn = db.getConnection()
+            
+            # Decide here whether to update or not.
+            #sql_load = "SELECT xyz FROM master_tbl_view WHERE id = %s" % id
+            #cur = conn.cursor()
+            #cur.execute(sql_load)
+            #row = cur.fetchone()
+            
+            new_data = {'id': id}
+            formed_suffix = {-1: 'ka', 0: 'aufsuchend', 1: 'nicht_aufsuchend'}
+            
+            sql_update = 'UPDATE master_tbl_view SET '
+            # Set the data for the different types
+            #print type_statistics
+            for logbook_type in type_statistics['types']:
+                if logbook_type['typ'] != None:
+                    tagebuch_kontakte = 'tagebuch_anzahl_kontakte_%s' % formed_suffix.get(logbook_type['typ'], 'ka')
+                    tagebuch_aufwand  = 'tagebuch_aufwand_stunden_%s' % formed_suffix.get(logbook_type['typ'], 'ka')
+                    tagebuch_prozent  = 'tagebuch_prozent_%s' % formed_suffix.get(logbook_type['typ'], 'ka')
+    
+                    sql_update = sql_update + ' %(kontakte)s = %%(%(kontakte)s)s, ' % {'kontakte': tagebuch_kontakte}
+                    sql_update = sql_update + ' %(aufwand)s = %%(%(aufwand)s)s, ' % {'aufwand': tagebuch_aufwand}
+                    sql_update = sql_update + ' %(prozent)s = %%(%(prozent)s)s, ' % {'prozent': tagebuch_prozent}
+
+                    new_data[tagebuch_kontakte] = logbook_type['amount']
+                    new_data[tagebuch_aufwand] = logbook_type['time']
+                    new_data[tagebuch_prozent] = logbook_type['percent']
+            
+            # Set the data for the general statistics
+            
+            sql_update = sql_update + 'tagebuch_anzahl_kontakte_gesamt = %s, ' % type_statistics['total']['amount']
+            sql_update = sql_update + 'tagebuch_aufwand_stunden_gesamt = %s, ' % type_statistics['total']['time']
+            sql_update = sql_update + 'tagebuch_prozent_gesamt = %s ' % type_statistics['total']['percent']
+            
+            #now put all together
+            sql_update = sql_update + ' WHERE id = %(id)s'
+            
+            #if update_case:
+            if type_statistics['types']:
+                #pass
+                #sql_update = """
+                    #UPDATE master_tbl_view
+                    #SET
+                        #tagebuch_anzahl_kontakte_ka = %(tagebuch_anzahl_kontakte_ka)s,
+                        #tagebuch_aufwand_stunden_ka = %(tagebuch_aufwand_stunden_ka)s,
+                        #tagebuch_prozent_ka = %(tagebuch_prozent_ka)s
+                    #WHERE id = %(id)s""" % new_data
+                print sql_update % new_data
+                cur = conn.cursor()
+                cur.execute(sql_update, new_data)
+                conn.commit()
+        finally:
+            db.recycleConnection(conn, cur)
+        
+        return render('/logbook/overview.mako')
\ No newline at end of file

Modified: waska/trunk/waskaweb/model/case.py
===================================================================
--- waska/trunk/waskaweb/model/case.py	2010-09-30 11:13:59 UTC (rev 3830)
+++ waska/trunk/waskaweb/model/case.py	2010-09-30 12:43:37 UTC (rev 3831)
@@ -48,6 +48,18 @@
     name_kompetenzagentur = %(ka_name)s
 WHERE id = %(id)s"""
 
+#INIT_CASE_SQL = """
+#UPDATE master_tbl_view
+#SET
+    #vorname = %(vorname)s,
+    #name = %(nachname)s,
+    #name_kompetenzagentur = %(ka_name)s,
+    #tagebuch_anzahl_kontakte_ka = %(tagebuch_anzahl_kontakte_ka)s,
+    #tagebuch_aufwand_stunden_ka = %(tagebuch_aufwand_stunden_ka)s,
+    #tagebuch_prozent_ka = %(tagebuch_prozent_ka)s
+#WHERE id = %(id)s"""
+
+
 SET_EDITOR_SQL = """SELECT set_case_editor(%(userid)s, %(caseid)s)"""
 SET_EDITOR_NAME_SQL = """
 SELECT set_case_editor_name(%(firstname)s, %(lastname)s, %(caseid)s)"""
@@ -69,7 +81,7 @@
 
 
 class CaseFactory(MpulsCaseFactory):
-
+    """ Initialise the case with some sensible values """
     def _initNewCase(self, id):
         conn, cur = None, None
         try:
@@ -79,6 +91,9 @@
                 'vorname': user.first_name,
                 'nachname': user.last_name,
                 'ka_name': agency.getName(),
+                #'tagebuch_anzahl_kontakte_ka': 1,
+                #'tagebuch_aufwand_stunden_ka': 0,
+                #'tagebuch_prozent_ka': 100,
                 'id': int(id)
                 }
             conn = db.getConnection()

Modified: waska/trunk/waskaweb/public/formed/annotations.xhtml
===================================================================
--- waska/trunk/waskaweb/public/formed/annotations.xhtml	2010-09-30 11:13:59 UTC (rev 3830)
+++ waska/trunk/waskaweb/public/formed/annotations.xhtml	2010-09-30 12:43:37 UTC (rev 3831)
@@ -633,5 +633,12 @@
       	Süchte, Verschuldung, familiäre Verpflichtungen
       </p>
     </div>
+    <div id="help-id-1:help:art_und_weise_des_erstkontaktes">
+      <p>
+      	Aufsuchend meint, dass das Erstgespräch ausßerhalb der Büroräume
+	stattfindet. Wichtig ist hier die &quot;Gehstruktur&quot; (die
+	Mitarbeiter/innen de KA gehen hin zum Jugendlichen).
+      </p>
+    </div>
   </body>
 </html>

Modified: waska/trunk/waskaweb/public/formed/formedtree.xml
===================================================================
--- waska/trunk/waskaweb/public/formed/formedtree.xml	2010-09-30 11:13:59 UTC (rev 3830)
+++ waska/trunk/waskaweb/public/formed/formedtree.xml	2010-09-30 12:43:37 UTC (rev 3831)
@@ -40,7 +40,7 @@
           <bool description="in der Maßnahme Schulverweigerung" name="war_sw_kunde" target="a:50"/>
           <bool description="Beratungskunde" name="war_ber_kunde" target="b"/>
         </group>
-        <group description="Zugang des Jugendlichen zur Kompetenzagentur" name="zugang_des_jugendlichen" target="f">
+        <group description="Erstinformation durch" name="erstinformation_durch" target="f">
           <choice description="Erstinformation durch" flags="evaluation:phase_x;required:phase_0" formularname="Zugang_Kompetenzagentur" name="zugang_kompetenzagentur" size="1" target="a">
             <bool checked="true" description="Keine Angabe" name="keineangabe" target="01" value="-1"/>
             <bool description="Unbekannt" name="unbekannt" target="10" value="-3"/>
@@ -1541,10 +1541,6 @@
       </group>
       <group description="8. Abschlussbewertung" name="5abschlussbewertung">
         <page containers="a,b,c,d" description="8.1. Angaben zum Verlauf und Beendigung des CM" name="page_16">
-          <group containers="a,b" description="Angaben zum Verlauf des CM" name="angabenzumverlaufdescm" target="a">
-            <int description="Anzahl der Kontakte/Termine mit dem Jugendlichen" formularname="Anzahl_Kontakte_Termine" maxvalue="999" minvalue="0" name="anzahl_kontakte_termine" target="a"/>
-            <int description="Anzahl der Stunden" formularname="Anzahl_der_Stunden" maxvalue="999" minvalue="0" name="anzahl_der_stunden" target="a"/>
-          </group>
           <group containers="a,b,c" description="Angaben zur Beendigung des CM" name="angabenzurbeendigungdescm" target="b">
             <date description="Beendigung CM (Datum)" flags="required:phase_3,phase_4;time:phase_3,phase_4" formularname="Beendigung" name="beendigung_5" order="datum_feststellung;beendigung_nachbetreuung" target="a"/>
             <rule description="phase cm nicht länger als 60 monate" expr="$datum_feststellung isset $beendigung_5 isset and $datum_feststellung known $beendigung_5 known and and $datum_feststellung $beendigung_5 days 1860 &gt; and not" mark="error:beendigung_5" name="rule-3" value='Die eingetragenen Datumsangaben sind offensichtlich falsch und überschreiten die maximale Dauer der Phase "Case Management". Bitte korrigieren Sie Ihre Angaben, da die Fallakte andernfalls nicht auswertbar ist.'/>



More information about the Mpuls-commits mailing list