Skip to content

Commit

Permalink
Increment challenge score when a whitelisted product is ordered & paid
Browse files Browse the repository at this point in the history
  • Loading branch information
ithiame committed Jun 16, 2023
1 parent 7b8dcb4 commit 5a482d6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/server/orders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ export async function onOrderPaid(order: Order, session: ClientSession) {
})
.toArray();
const challenges = await collections.challenges
.find({ mode: 'moneyAmount', beginsAt: { $lt: new Date() }, endsAt: { $gt: new Date() } })
.find({
mode: 'moneyAmount',
beginsAt: { $exists: true, $lt: new Date() },
endsAt: { $gt: new Date() }
})
.toArray();
for (const challenge of challenges) {
await collections.challenges.updateOne(
Expand Down

0 comments on commit 5a482d6

Please sign in to comment.