From 00fd7cbeeb342820daaf72cbbe15b12a7f2beb4e Mon Sep 17 00:00:00 2001 From: Riccardo Berto Date: Thu, 25 Feb 2021 08:15:24 +0100 Subject: [PATCH] added java reference code for calories calc --- calories.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 calories.py diff --git a/calories.py b/calories.py new file mode 100644 index 0000000..bf77d3f --- /dev/null +++ b/calories.py @@ -0,0 +1,12 @@ +""" +Repo: https://codeberg.org/jannis/FitoTrack +commit: bd78b065cbe6083b2fee4c151f9125304392e21d +filepath: https://codeberg.org/jannis/FitoTrack/src/commit/bd78b065cbe6083b2fee4c151f9125304392e21d/app/src/main/java/de/tadris/fitness/util/CalorieCalculator.java + +Java calories calc code: +public static int calculateCalories(Context context, Workout workout, double weight) { + double mins = (double) (workout.duration / 1000) / 60; + int ascent = (int) workout.ascent; // 1 calorie per meter + return (int) (mins * (getMET(context, workout) * 3.5 * weight) / 200) + ascent; + } +""" \ No newline at end of file