Fix bug - adding current values to previous day on stop
authorandrei1089 <andrei.mirestean@gmail.com>
Mon, 15 Feb 2010 08:37:35 +0000 (10:37 +0200)
committerandrei1089 <andrei.mirestean@gmail.com>
Mon, 15 Feb 2010 08:37:35 +0000 (10:37 +0200)
The bug was due to python's evaluation of default arguments at
definition time. This was causing the addition of time/steps/etc..
to the values of the day widget was added instead of the current
day's values.

src/usr/lib/hildon-desktop/pedometer_widget_home.py

index ea1f39c..57f1c98 100644 (file)
@@ -241,7 +241,9 @@ class PedoRepository(Singleton):
     def get_values(self):
         return self.values
 
-    def add_values(self, values, when=date.today()):
+    def add_values(self, values, when=None):
+        if when is None:
+            when = date.today()
         """add PedoValues values to repository """
         try:
             self.values[when] = self.values[when] + values