Skip to content

Commit

Permalink
fix: correctly calculate distance if roundTrip is present (#2839)
Browse files Browse the repository at this point in the history
* fix: correctly calculate distance if roundTrip is present

* pr comments
  • Loading branch information
suyashpatil78 committed Mar 21, 2024
1 parent cc7963a commit 9bdc089
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ export class RouteSelectorModalComponent implements OnInit {
} else {
const distanceInKm = distance / 1000;
const finalDistance = this.unit === 'MILES' ? distanceInKm * 0.6213 : distanceInKm;
if (this.form.controls.roundTrip.value) {
//value comes as an Input in this component, if roundTrip is already set double the value during initialization
if (this.value?.roundTrip) {
this.calculatedLocationDistance = parseFloat((finalDistance * 2).toFixed(2));
} else {
this.calculatedLocationDistance = parseFloat(finalDistance.toFixed(2));
Expand Down

0 comments on commit 9bdc089

Please sign in to comment.