[Mpuls-commits] r4125 - in base/trunk: . mpulsweb/lib mpulsweb/templates/logbook

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Nov 4 12:27:10 CET 2010


Author: roland
Date: 2010-11-04 12:27:09 +0100 (Thu, 04 Nov 2010)
New Revision: 4125

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/lib/evaluation.py
   base/trunk/mpulsweb/templates/logbook/evaluation_typ.mako
Log:
issue1090: don't count the default entry in the statistic

Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-11-03 16:10:30 UTC (rev 4124)
+++ base/trunk/ChangeLog	2010-11-04 11:27:09 UTC (rev 4125)
@@ -1,3 +1,9 @@
+2010-11-04  Roland Geider <roland.geider at intevation.de>
+
+	* mpulsweb/lib/evaluation.py,
+	  mpulsweb/templates/logbook/evaluation_typ.mako: issue1090: don't
+	  count the default "case created" entry for the logbook statistic
+
 2010-11-03  Bernhard Herzog  <bh at intevation.de>
 
 	* mpulsweb/controllers/navigation.py

Modified: base/trunk/mpulsweb/lib/evaluation.py
===================================================================
--- base/trunk/mpulsweb/lib/evaluation.py	2010-11-03 16:10:30 UTC (rev 4124)
+++ base/trunk/mpulsweb/lib/evaluation.py	2010-11-04 11:27:09 UTC (rev 4125)
@@ -105,7 +105,6 @@
 
                     result['sum_all'][0] += num
                     result['sum_all'][1] += int(duration)
-
                 return result
             except StandardError, e:
                 log.exception(e)
@@ -120,12 +119,17 @@
             conn = db.getConnection()
             cur = conn.cursor()
             cur.execute(self.sql_typ)
-            rows = cur.fetchall()
             
+            # The "category" statistics above does not count the default entry
+            # "case created" so we will ignore the first entry (which will always
+            # be the case-created one) to match it
+            rows = cur.fetchall()[1:]
+            
+            
             # Initiate statistical data. Then iterate thorugh the data to
             # generate the real ones. Bit ugly.
             result = {'total': [], 'types':[]}
-            total = {'amount': 0, 'time': 0, 'percent': 100}
+            total = {'amount': 0, 'time': 0, 'percent': 0}
             
             for row in rows:
                 total['amount'] = total['amount'] + row[1]
@@ -138,8 +142,8 @@
                                 'time' : timedelta_in_minutes(row[0]),
                                 'percent': percent,
                                 'amount' : row[1]})
+                    total['percent'] += percent
             result['total'] = total
-            
             return result
         finally:
             db.recycleConnection(conn, cur)

Modified: base/trunk/mpulsweb/templates/logbook/evaluation_typ.mako
===================================================================
--- base/trunk/mpulsweb/templates/logbook/evaluation_typ.mako	2010-11-03 16:10:30 UTC (rev 4124)
+++ base/trunk/mpulsweb/templates/logbook/evaluation_typ.mako	2010-11-04 11:27:09 UTC (rev 4125)
@@ -12,7 +12,7 @@
     <tr>
         <th class="table_header_h ">Art</th>
         <th class="table_header_h table_width_mid_s num">Anzahl der Kontakte</th>
-        <th class="table_header_h table_width_mid_s num">Aufwand in Stunden</th>
+        <th class="table_header_h table_width_mid_s num">Aufwand (Minuten)</th>
         <th class="table_header_h table_width_mid_s num">in Prozent</th>
     </tr>
     % for class_statistic in c.eval_typ_effort['types']:



More information about the Mpuls-commits mailing list