File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change
1
+ const METERS_IN_ONE_KM = 1000 ;
2
+
3
+ export { METERS_IN_ONE_KM } ;
Original file line number Diff line number Diff line change
1
+ import { METERS_IN_ONE_KM } from '../constants/constants.js' ;
2
+
1
3
const convertMetersToKm = ( meters : number ) : number => {
2
- return meters / 1000 ;
4
+ return meters / METERS_IN_ONE_KM ;
3
5
} ;
4
6
5
7
export { convertMetersToKm } ;
Original file line number Diff line number Diff line change @@ -41,8 +41,9 @@ class MapService {
41
41
} ) : Promise < number > {
42
42
const distance = await this . getDistance ( startPoint , endPoint ) ;
43
43
const km = convertMetersToKm ( distance . value ) ;
44
+ const orderPrice = ( pricePerKm * km ) . toFixed ( 2 ) ;
44
45
45
- return + ( pricePerKm * km ) . toFixed ( 2 ) ;
46
+ return Number ( orderPrice ) ;
46
47
}
47
48
}
48
49
You can’t perform that action at this time.
0 commit comments