Skip to content

Commit

Permalink
Merge pull request #116 from Josh-Voyles/backend-divide-by-zero-error
Browse files Browse the repository at this point in the history
Resolved issue #115: Divide by zero error
  • Loading branch information
Josh-Voyles authored Jun 24, 2024
2 parents 0418e19 + 2ebdeed commit da06803
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion home-choice-pro/models/affordability_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def _adjust_for_property_taxes_and_insurance(self):
def _calculate_monthly_pmi_payment(self) -> float:
"""Helper function to factor PMI percentage into home affordability price."""
loan_amount = self.calculate_loan_principal()
if loan_amount == 0:
if loan_amount == 0 or self.home_affordability_price == 0:
return 0.0
loan_to_value_ratio = loan_amount / self.home_affordability_price
if loan_to_value_ratio <= 0.8:
Expand Down

0 comments on commit da06803

Please sign in to comment.