Skip to content

Commit

Permalink
add conditions for amount to follow
Browse files Browse the repository at this point in the history
  • Loading branch information
madjid-asa committed Jul 5, 2024
1 parent d843035 commit 5408051
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lemarche/tenders/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,12 @@ def save(self, *args, **kwargs):
try:
self.set_slug()
# generate random status for is_followed_by_us
if not self.pk and self.kind == tender_constants.KIND_PROJECT and self.is_followed_by_us is None:
if (
not self.pk
and self.kind == tender_constants.KIND_PROJECT
and self.is_followed_by_us is None
and self.amount_int > settings.BREVO_TENDERS_MIN_AMOUNT_TO_SEND
):
self.is_followed_by_us = random.random() < 0.5 # 50% True, 50% False
with transaction.atomic():
super().save(*args, **kwargs)
Expand Down

0 comments on commit 5408051

Please sign in to comment.