Skip to content

Commit

Permalink
fix: fix #280 updated value to get directly from listing (#281)
Browse files Browse the repository at this point in the history
Co-authored-by: Natalia Venditto <nataliafrontend@gmail.com>
  • Loading branch information
Tanmai2002 and anfibiacreativa committed Aug 23, 2023
1 parent 146bec9 commit 0d1f0e8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class BookingFormComponent implements OnInit {

capacityMapping: { [k: string]: string } = { "=1": "One guest", other: "# guests" };
monthsMapping: { [k: string]: string } = { "=0": "0 month", "=1": "1 month", other: "# months" };

isGuest = signal(false);
monthlyRentPrice = signal(0);
monthlyRentPriceWithDiscount = signal(0);
Expand Down Expand Up @@ -90,7 +90,7 @@ export class BookingFormComponent implements OnInit {
return;
}

const rentPriceWithDiscount = this.monthlyRentPrice() * (1 - (parseInt(this.listing?.fees?.[4], 10) || 0) / 100);
const rentPriceWithDiscount = (Number(this.listing?.fees?.[3]) || 0) * (1 - (parseInt(this.listing?.fees?.[4], 10) || 0) / 100);
this.monthlyRentPrice.set(Number(this.listing?.fees?.[3]) || 0);
this.monthlyRentPriceWithDiscount.set(Math.max(0, rentPriceWithDiscount));
this.currency_code = this.listing?.fees?.[5].substring(0, 3);
Expand Down

0 comments on commit 0d1f0e8

Please sign in to comment.