Hi, I think that the current way to count calories has a few problems:
1) setting the met is not very intuitive, at least it wasn't for me;
2) more problematicly this setting is per sport and not per session so it's not a reliable way to compute calories (I can run at very different speed).

I propose to solve both problems using a different formula that will be used only if someone doesn't specify the met value for a sport. You can see an example for the "Run", I used a formula taken from http://www.albanesi.it/english/sport/running_energy_expenditure.htm, the same could be done for the bike and other activity.
What do you think?
--- /tmp/pytrainer-1.10.1/pytrainer/gui/windowrecord.py	2013-03-31 12:28:29.000000000 +0200
+++ /usr/lib/pymodules/python2.7/pytrainer/gui/windowrecord.py	2014-04-23 19:58:40.574712927 +0200
@@ -672,6 +672,7 @@
         sec = self.rcd_second.get_value_as_int()
         hour += float(min)/60.0 + float(sec)/(60.0*60.0)
         weight = self.pytrainer_main.profile.getValue("pytraining","prf_weight")
+        distance = float(self.rcd_distance.get_text())
         try:
             weight = float(weight)
         except:
@@ -688,6 +689,10 @@
         if met is not None:
             calories = met*(weight+extraweight)*hour
             self.rcd_calories.set_text(str(calories))
+        else:
+            if sport == "Run":
+                calories = (weight+extraweight)*distance*0.9
+                self.rcd_calories.set_text(str(calories))
 
     def on_calcdistance_clicked(self,widget):
         logging.debug(">>")
------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Pytrainer-devel mailing list
Pytrainer-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytrainer-devel

Reply via email to