Skip to content

Commit

Permalink
fix: "division by zero" issue in updating points per day 🏆 (#553)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiAbdou authored Oct 7, 2024
1 parent b210ba0 commit 1234abf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/core/src/modules/member/member.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,12 @@ async function updatePointTotals() {

({ ref }) => {
const daysSinceAccepted = sql<number>`
extract(
day from (
current_timestamp - ${ref('acceptedAt')}
greatest(
1,
extract(
day from (
current_timestamp - ${ref('acceptedAt')}
)
)
)
`;
Expand Down

0 comments on commit 1234abf

Please sign in to comment.