Use running calorie calculation for hiking

This commit is contained in:
jannis 2019-08-25 13:23:29 +02:00
parent 4b4cb52138
commit 393fd4aba9

View File

@ -48,14 +48,10 @@ public class CalorieCalculator {
*/ */
public static double getMET(Workout workout){ public static double getMET(Workout workout){
double speedInKmh= workout.avgSpeed * 3.6; double speedInKmh= workout.avgSpeed * 3.6;
if(workout.workoutType.equals(Workout.WORKOUT_TYPE_RUNNING)){ if(workout.workoutType.equals(Workout.WORKOUT_TYPE_RUNNING) || workout.workoutType.equals(Workout.WORKOUT_TYPE_HIKING)){
// This is a linear graph based on the website linked above // This is a linear graph based on the website linked above
return Math.max(1.5, speedInKmh*1.117 - 2.1906); return Math.max(1.5, speedInKmh*1.117 - 2.1906);
} }
if(workout.workoutType.equals(Workout.WORKOUT_TYPE_HIKING)){
// Use fixed MET because no more precise calculation was found
return 6.0;
}
if(workout.workoutType.equals(Workout.WORKOUT_TYPE_CYCLING)){ if(workout.workoutType.equals(Workout.WORKOUT_TYPE_CYCLING)){
// This is a linear graph based on the website linked above // This is a linear graph based on the website linked above
return Math.max(3, (speedInKmh-10) / 1.5); return Math.max(3, (speedInKmh-10) / 1.5);