From 8571584137c3316440c3501e361d8aae240d6e6d Mon Sep 17 00:00:00 2001 From: "madjid.asa" Date: Thu, 28 Dec 2023 14:09:18 +0100 Subject: [PATCH] order by super esi --- lemarche/siaes/models.py | 4 ++++ lemarche/www/tenders/tasks.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lemarche/siaes/models.py b/lemarche/siaes/models.py index 2c5068098..06755c735 100644 --- a/lemarche/siaes/models.py +++ b/lemarche/siaes/models.py @@ -489,6 +489,10 @@ def with_employees_stats(self): ), ) + def order_by_super_siaes(self): + # need to be better specified in the future + return self.order_by("-tender_detail_display_count", "-tender_detail_display_count", "-completion_rate") + class Siae(models.Model): FIELDS_FROM_C1 = [ diff --git a/lemarche/www/tenders/tasks.py b/lemarche/www/tenders/tasks.py index d52c65365..8b2e28630 100644 --- a/lemarche/www/tenders/tasks.py +++ b/lemarche/www/tenders/tasks.py @@ -59,7 +59,7 @@ def send_tender_emails_to_siaes(tender: Tender): siae_users_send_count = 0 # queryset - all_siaes = tender.siaes.filter(tendersiae__email_send_date=None) + all_siaes = tender.siaes.filter(tendersiae__email_send_date=None).order_by_super_siaes() logger.info(f"total siaes {all_siaes.count()}") siaes = all_siaes[: tender.limit_send_to_siae_batch]