Skip to content

Commit 03c49c7

Browse files
author
LazyTesting
committed
renaming of highest speed
1 parent 571fa1b commit 03c49c7

File tree

7 files changed

+10
-11
lines changed

7 files changed

+10
-11
lines changed

core/calculate-angle/app.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ const get = function Get(pos1, pos2) {
99
return calculateAngle(vertical, horizontal);
1010
};
1111

12-
13-
// TODO check axis
1412
const calculateAngle = function(x, y)
1513
{
1614
const tan = Math.atan2(x, y);

core/calculate-angle/spec.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
const assert = require('assert');
22
const angle = require('./app.js');
33

4-
const pos1 = { lat: '46.974974', lon: '10.311162', ele: 13 };
5-
const pos2 = { lat: '46.97495', lon: '10.311144', ele: 10 };
4+
const pos1 = { lat: '46.975419', lon: '10.311633', ele: 13 };
5+
const pos2 = { lat: '46.975569', lon: '10.31181', ele: 6 };
66

77
describe('calculate angle between to points', () => {
88

99
it('should return a positive number', () => {
1010
const result = angle(pos1, pos2);
11-
assert(result > 0);
11+
assert(result > 17);
12+
assert(result < 19);
1213
});
1314
});
1415

engine/highest-downhill-slope-angle/spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('Read and parse data from disk', () => {
77
it('should return results', () => {
88
const filePath = path.join(__dirname, '/test/data.gpx');
99
const gpx = fs.readFileSync(filePath, 'utf8');
10-
const result = angle(gpx, 5);
10+
const result = angle(gpx, 15);
1111
console.log(result);
1212
assert.ok(result > 0);
1313
});

engine/highest-total-speed/app.js renamed to engine/highest-downhill-speed/app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ const createReduce = seconds => (carry, item) => {
2929
* returns the total downhill distance of the track
3030
* @param {String} gpxContent - gpx document
3131
* @param {Number} seconds - timeframe to calculate average
32-
* @returns {Number} anlge - maximum slope angle
32+
* @returns {Number} speed - maximum speed in km/h
3333
*/
3434
const get = function(gpxContent, seconds) {
3535
const points = convertGPX(gpxContent);
3636
const distances = points.reduce(createReduce(seconds), [[]]);
37-
const angles = distances.map(ele => speed(tdistance(ele[0], ele[ele.length - 1]), timeDiff(ele[0], ele[ele.length - 1])));
37+
const speeds = distances.map(ele => speed(tdistance(ele[0], ele[ele.length - 1]), timeDiff(ele[0], ele[ele.length - 1])));
3838

39-
return angles.reduce((carry, item) => Math.max(carry, item), angles.shift());
39+
return speeds.reduce((carry, item) => Math.max(carry, item), speeds.shift());
4040
};
4141

4242
module.exports = get;

engine/highest-total-speed/package.json renamed to engine/highest-downhill-speed/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "highest-total-speed",
3-
"version": "0.1.0",
2+
"name": "highest-downhill-speed",
3+
"version": "0.2.0",
44
"description": "",
55
"main": "app.js",
66
"scripts": {

0 commit comments

Comments
 (0)