Skip to content

Commit

Permalink
fix: division by zero error in donation eligibility calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
anshg1214 authored and amCap1712 committed Sep 24, 2024
1 parent 4fe9641 commit 39e910c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions listenbrainz/db/donation.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def get_recent_donors(meb_conn, db_conn, count: int, offset: int):
, bool_or(
(
(amount + fee)
/ ceiling(EXTRACT(days from now() - payment_date) / 30.0)
/ GREATEST(ceiling(EXTRACT(days from now() - payment_date) / 30.0), 1)
)
>= :threshold
) OVER (PARTITION BY editor_id) AS show_flair
Expand Down Expand Up @@ -123,7 +123,7 @@ def get_biggest_donors(meb_conn, db_conn, count: int, offset: int):
, (
(
(amount + fee)
/ ceiling(EXTRACT(days from now() - payment_date) / 30.0)
/ GREATEST(ceiling(EXTRACT(days from now() - payment_date) / 30.0), 1)
)
>= :threshold
) AS is_donation_eligible
Expand Down

0 comments on commit 39e910c

Please sign in to comment.