Skip to content

Commit e312186

Browse files
committed
th-230: * map service added contants
1 parent 359618c commit e312186

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const METERS_IN_ONE_KM = 1000;
2+
3+
export { METERS_IN_ONE_KM };
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import { METERS_IN_ONE_KM } from '../constants/constants.js';
2+
13
const convertMetersToKm = (meters: number): number => {
2-
return meters / 1000;
4+
return meters / METERS_IN_ONE_KM;
35
};
46

57
export { convertMetersToKm };

backend/src/packages/map/map.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ class MapService {
4141
}): Promise<number> {
4242
const distance = await this.getDistance(startPoint, endPoint);
4343
const km = convertMetersToKm(distance.value);
44+
const orderPrice = (pricePerKm * km).toFixed(2);
4445

45-
return +(pricePerKm * km).toFixed(2);
46+
return Number(orderPrice);
4647
}
4748
}
4849

0 commit comments

Comments
 (0)