Skip to content

Instantly share code, notes, and snippets.

@simekadam
Created March 11, 2016 22:28
Show Gist options
  • Save simekadam/65d64c39c1d5ece34fb1 to your computer and use it in GitHub Desktop.
Save simekadam/65d64c39c1d5ece34fb1 to your computer and use it in GitHub Desktop.
//! The given info object contains all the current workout
//! information. Calculate a value and return it in this method.
function compute(info) {
// See Activity.Info in the documentation for available information.
var minutesPerMile = 1 / (info.currentSpeed * 60 / 1609.34);
var minutes = minutesPerMile.toNumber();
var seconds = (minutesPerMile - minutes) * 60;
if (seconds < 10) {
seconds = "0"+seconds;
} else {
seconds = seconds.toNumber();
}
return minutes + ":" + seconds;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment