Created
March 11, 2016 22:28
-
-
Save simekadam/65d64c39c1d5ece34fb1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! 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