-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Task] #77, calculate more Status data
- Loading branch information
1 parent
f76fe8e
commit 2d57a38
Showing
3 changed files
with
48 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const getMaxSpeed = function (cleanEntries:Models.IEntry[]) { | ||
let maxSpeed = cleanEntries.reduce((maxSpeed, entry:Models.IEntry) => { | ||
// compare the current entry's GPS speed with the maxSpeed found so far | ||
return Math.max(maxSpeed, entry.speed.gps); | ||
}, cleanEntries[0].speed.gps); | ||
return maxSpeed *= 3.6; // convert M/S to KM/h | ||
}; |