Skip to content

Commit

Permalink
T1826 T1845 FIX division by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
ecino committed Sep 24, 2024
1 parent 59c06db commit ee5ca5c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crowdfunding_compassion/models/crowdfunding_participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def _compute_product_number_reached(self):
lambda line: line.payment_state == "paid"
)
price_total = sum(invl.mapped("price_total"))
standard_price = participant.project_id.product_id.standard_price
standard_price = participant.project_id.product_id.standard_price or 1
participant.product_number_reached = round(price_total / standard_price)

def _compute_sponsorships(self):
Expand Down
2 changes: 1 addition & 1 deletion crowdfunding_compassion/models/crowdfunding_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def _compute_product_number_reached(self):
price_total = results.get(project.id, 0)
project.amount_reached = round(price_total)
project.product_number_reached = round(
price_total / project.product_id.standard_price
price_total / (project.product_id.standard_price or 1)
)

def _compute_number_sponsorships_goal(self):
Expand Down

0 comments on commit ee5ca5c

Please sign in to comment.