From 54080518d7e6761856c4b1a07d4acf2df9b2cc98 Mon Sep 17 00:00:00 2001 From: "madjid.asa" Date: Fri, 5 Jul 2024 13:27:24 +0200 Subject: [PATCH] add conditions for amount to follow --- lemarche/tenders/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lemarche/tenders/models.py b/lemarche/tenders/models.py index ba2a6febc..0e471aa42 100644 --- a/lemarche/tenders/models.py +++ b/lemarche/tenders/models.py @@ -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)