[Mpuls-commits] r131 - in waska/trunk: . formed waskaweb/lib waskaweb/model waskaweb/templates/casemanagement

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Sep 3 18:14:07 CEST 2008


Author: teichmann
Date: 2008-09-03 18:14:06 +0200 (Wed, 03 Sep 2008)
New Revision: 131

Modified:
   waska/trunk/ChangeLog.txt
   waska/trunk/formed/formedtree_web.xml
   waska/trunk/waskaweb/lib/helpers.py
   waska/trunk/waskaweb/model/phases.py
   waska/trunk/waskaweb/model/phases_factory.py
   waska/trunk/waskaweb/templates/casemanagement/phase.mako
Log:
Sum up times in phases.



Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt	2008-09-03 15:06:36 UTC (rev 130)
+++ waska/trunk/ChangeLog.txt	2008-09-03 16:14:06 UTC (rev 131)
@@ -1,5 +1,20 @@
 2008-09-03  Sascha L. Teichmann <sascha.teichmann at intevation.de>
 
+	Sum up times in phases
+
+	* waskaweb/model/phases_factory.py: Fix bug in accessing time
+
+	* waskaweb/model/phases.py: Fix attribute error
+
+	* waskaweb/lib/helpers.py: add default parameter to human_timedelta()
+
+	* waskaweb/templates/casemanagement/phase.mako: Sum up the time deltas
+
+	* formed/formedtree_web.xml: Mark fields for phase times. TODO: Sync with
+	  formed tree from database setup.
+
+2008-09-03  Sascha L. Teichmann <sascha.teichmann at intevation.de>
+
 	Load phase times from database.
 
 	* waskaweb/model/phases_factory.py: Load phase times from database. 

Modified: waska/trunk/formed/formedtree_web.xml
===================================================================
--- waska/trunk/formed/formedtree_web.xml	2008-09-03 15:06:36 UTC (rev 130)
+++ waska/trunk/formed/formedtree_web.xml	2008-09-03 16:14:06 UTC (rev 131)
@@ -23,7 +23,7 @@
         <text description="Vorname" formularname="Vorname" function="suppress_value" maxlength="60" name="vorname" size="50"/>
         <text description="Name" formularname="Name" function="hash_value:vorname" maxlength="255" name="name" size="40"/>
       </group>
-      <date description="Datum des Erstgespräches mit dem Jugendlichen" flags="required:clearing_start" formularname="Erstgespräch" name="erstgespraech" target="d"/>
+      <date description="Datum des Erstgespräches mit dem Jugendlichen" flags="required:clearing_start;time:clearing_start" formularname="Erstgespräch" name="erstgespraech" target="d"/>
       <group containers="a" description=" Der Jugendliche war bereits zuvor (Mehrfachantwort möglich)" name="war_bereits_kunde" target="e">
         <bool description="im Case-Management" name="war_cm_kunde" target="a:50"/>
         <bool description="in der Maßnahme Schulverweigerung" name="war_sw_kunde" target="a:50"/>
@@ -518,7 +518,7 @@
             <bool description="Nein" name="Nein" value="0"/>
           </choice>
           <date description="Datum der Entscheidung"
-	  flags="required:clearing_ende,beratung_start,cm_start" name="datum_feststellung" target="a:50"/>
+	  flags="required:clearing_ende,beratung_start,cm_start;time:clearing_ende,cm_start" name="datum_feststellung" target="a:50"/>
         </group>
         <group containers="a" description="Case-Management-Fall" name="case_management_fall" target="c">
           <choice description="Kompetenzfeststellung ist erforderlich mit folgender primärer Zielsetzung" formularname="Zielsetzung" name="zielsetzung" size="1" target="a">
@@ -543,7 +543,7 @@
             <text description="Nennung Vermittlung" formularname="welche_vermittlung_nennung" maxlength="60" modes="default" name="welche_vermittlung_nennung" size="40" target="a:50"/>
           </group>
           <text description="Gründe für die Beratung" maxlength="60" name="beratungsfortsetzung" size="40" target="b:50"/>
-          <date description="Datum Beratungsende" flags="required:beratung_ende" name="datum_ende_beratung" target="b:50"/>
+          <date description="Datum Beratungsende" flags="required:beratung_ende;time:beratung_ende" name="datum_ende_beratung" target="b:50"/>
         </group>
         <textarea cols="80" description="Freie Dokumentation" formularname="Freie_Dokumentation" function="suppress_value" modes="-mode1.1anon" name="freie_dokumentation" rows="20" target="e"/>
       </group>
@@ -1449,7 +1449,7 @@
           <int description="Zeitraum CM (in Wochen)" flags="evaluation" formularname="Zeitraum_Fallmanagement" maxvalue="250" minvalue="0" name="zeitraum_fallmanagement" target="b"/>
         </group>
         <group containers="a,b,c" description="Angaben zur Beendigung des CM" name="angabenzurbeendigungdescm" target="c">
-          <date description="Beendigung CM (Datum)" flags="required:cm_ende,nb_start" formularname="Beendigung" name="beendigung_5" target="a"/>
+          <date description="Beendigung CM (Datum)" flags="required:cm_ende,nb_start;time:cm_ende" formularname="Beendigung" name="beendigung_5" target="a"/>
           <choice description="Art der Beendigung" flags="evaluation;required:cm_ende" formularname="Art_Beendigung" name="art_beendigung" size="1" target="a">
             <bool checked="s" description="Keine Angabe" name="keineangabe" value="-1"/>
             <bool description="vorzeitige Beendigung" name="vorzeitig" value="2"/>

Modified: waska/trunk/waskaweb/lib/helpers.py
===================================================================
--- waska/trunk/waskaweb/lib/helpers.py	2008-09-03 15:06:36 UTC (rev 130)
+++ waska/trunk/waskaweb/lib/helpers.py	2008-09-03 16:14:06 UTC (rev 131)
@@ -104,9 +104,9 @@
         d = datetime.datetime(d.year, d.month, d.day)
     return "%02d:%02d" % (d.hour, d.minute)
 
-def dd_mm_yyyy_HH_MM(d):
+def dd_mm_yyyy_HH_MM(d, empty = ''):
     ''' datetime.strftime() dislikes years before 1900. '''
-    if d is None: return ''
+    if d is None: return empty
     if type(d) is datetime.date:
         # not so smart
         d = datetime.datetime(d.year, d.month, d.day)
@@ -121,8 +121,8 @@
     secs = ti.seconds / 60.0
     return round(days + secs)
 
-def human_timedelta(td):
-    if td is None: return None
+def human_timedelta(td, empty=None):
+    if td is None: return empty
     out = []
     if -td == abs(td):
         out.append("-")

Modified: waska/trunk/waskaweb/model/phases.py
===================================================================
--- waska/trunk/waskaweb/model/phases.py	2008-09-03 15:06:36 UTC (rev 130)
+++ waska/trunk/waskaweb/model/phases.py	2008-09-03 16:14:06 UTC (rev 131)
@@ -76,7 +76,7 @@
 
     def getDuration(self):
         t1 = self.start.getTime()
-        t2 = self.stop.getTime()
+        t2 = self.end.getTime()
         if not t1 or not t2: return None
         return t2 - t1
 

Modified: waska/trunk/waskaweb/model/phases_factory.py
===================================================================
--- waska/trunk/waskaweb/model/phases_factory.py	2008-09-03 15:06:36 UTC (rev 130)
+++ waska/trunk/waskaweb/model/phases_factory.py	2008-09-03 16:14:06 UTC (rev 131)
@@ -185,7 +185,7 @@
 
     def getPhaseTime(self, phase):
         try:
-            time = self.times[phase][1]
+            return self.times[phase][0][1]
         except KeyError:
             return None
 

Modified: waska/trunk/waskaweb/templates/casemanagement/phase.mako
===================================================================
--- waska/trunk/waskaweb/templates/casemanagement/phase.mako	2008-09-03 15:06:36 UTC (rev 130)
+++ waska/trunk/waskaweb/templates/casemanagement/phase.mako	2008-09-03 16:14:06 UTC (rev 131)
@@ -35,7 +35,7 @@
       <td class="required_field">
         ${p1.getLinks()}
       </td>
-      <td>${p1.getTime()}</td>
+      <td>${h.dd_mm_yyyy_HH_MM(p1.getTime(), '-/-')}</td>
       <td style="text-align:right">
         % if p1.isComplete() and not p1.isRunning() and p1.isNeighbor(c.current_phase):
             <input type="submit" value="Start ${phase_pair.getDescription()|h}" name="${p1.getLabel()|h}">
@@ -54,7 +54,7 @@
       <td class="table_row_h required_field">
         ${p2.getLinks()}
       </td>
-      <td class="table_row_h">${p2.getTime()}</td>
+      <td class="table_row_h">${h.dd_mm_yyyy_HH_MM(p2.getTime(), '-/-')}</td>
       <td style="text-align:right" class="table_row_h">
         % if p2.isComplete() and p2.isRunning():
             <input type="submit" value="Ende ${p2.getDescription()|h}" name="${p2.getLabel()|h}">
@@ -78,25 +78,24 @@
       <th class="table_header_h">Phase</th>
       <th style="text-align:right" class="table_header_h">Dauer in Wochen</th>
     </tr>
+    <% total = None %>
+    % for phase_pair in c.phase_pairs:
     <tr>
-      <td>Clearing</td>
-      <td style="text-align:right">???</td>
+      <td>${phase_pair.getDescription()|h}</td>
+      <td style="text-align:right">
+      <% 
+        t = phase_pair.getDuration();
+        if t: total = total and (total + t) or t
+      %>
+      ${h.human_timedelta(t, '-/-')}
+      </td>
     </tr>
+    % endfor
     <tr>
-      <td>Case-Management</td>
-      <td style="text-align:right">???</td>
-    </tr>
-    <tr>
-      <td>Beratungskunde</td>
-      <td style="text-align:right">???</td>
-    </tr>
-    <tr>
-      <td>Nachbetreuung</td>
-      <td style="text-align:right">???</td>
-    </tr>
-    <tr>
       <td style="border-top:1px solid"><strong>Gesamt</strong></td>
-      <td style="border-top:1px solid; text-align:right"><strong>???</strong></td>
+      <td style="border-top:1px solid; text-align:right">
+        <strong>${h.human_timedelta(total, '-/-')}</strong>
+      </td>
     </tr>
   </table>
 </div>



More information about the Mpuls-commits mailing list