From 2bac2efb777e00f6f1472db61e41094a6e32d7b5 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Mon, 15 Jan 2024 16:21:17 +0100 Subject: [PATCH] Cleanup --- .../templates/tenders/_detail_admin_extra_info.html | 10 +++++++--- lemarche/templates/tenders/detail.html | 6 +++--- lemarche/tenders/models.py | 4 ++++ lemarche/www/tenders/views.py | 11 +---------- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/lemarche/templates/tenders/_detail_admin_extra_info.html b/lemarche/templates/tenders/_detail_admin_extra_info.html index bb5485fa1..d8f45f74f 100644 --- a/lemarche/templates/tenders/_detail_admin_extra_info.html +++ b/lemarche/templates/tenders/_detail_admin_extra_info.html @@ -18,20 +18,24 @@

Informations Admin

{{ tender.siae_email_send_date_count }} prestataire{{ tender.siae_email_send_date_count|pluralize }} ciblé{{ tender.siae_email_send_date_count|pluralize }}
  • - + {{ tender.siae_email_link_click_date_or_detail_display_date_count }} prestataire{{ tender.siae_email_link_click_date_or_detail_display_date_count|pluralize }} qui {{ tender.siae_email_link_click_date_or_detail_display_date_count|pluralize:'a,ont' }} vu
  • {{ tender.siae_detail_contact_click_date_count }} prestataire{{ tender.siae_detail_contact_click_date_count|pluralize }} intéressé{{ tender.siae_detail_contact_click_date_count|pluralize }}
  • +
  • + + {{ tender.siae_detail_not_interested_click_date_count }} prestataire{{ tender.siae_detail_not_interested_click_date_count|pluralize }} pas intéressé{{ tender.siae_detail_not_interested_click_date_count|pluralize }} +
  • {% if not tender.deadline_date_outdated %}
  • Transactionné : {% if tender.siae_transactioned == None %} - Inconnu + inconnu {% else %} - {{ tender.siae_transactioned.value|yesno:"Oui,Non" }} + {{ tender.siae_transactioned.value|yesno:"✅,❌" }} {% endif %}
  • {% endif %} diff --git a/lemarche/templates/tenders/detail.html b/lemarche/templates/tenders/detail.html index 787c0669c..e8c7ef204 100644 --- a/lemarche/templates/tenders/detail.html +++ b/lemarche/templates/tenders/detail.html @@ -109,7 +109,7 @@ Besoin d'aide ? contacter le support via le chat en ligne qui se trouve en bas à droite.

    - {% elif not (siae_has_detail_contact_click_date or siae_has_detail_not_interested_click_date) %} + {% elif not siae_has_detail_contact_click_date %} {% include "tenders/_detail_cta.html" with tender=tender user_can_click=True %} {% include "tenders/_detail_cta_cocontracting.html" with tender=tender %} {% include "tenders/_detail_cta_not_interested.html" with tender=tender %} @@ -117,7 +117,7 @@ {% endif %} {% comment %} if siae_id {% endcomment %} {% elif siae_id and not tender.response_is_anonymous %} - {% if not (siae_has_detail_contact_click_date or siae_has_detail_not_interested_click_date) %} + {% if not siae_has_detail_contact_click_date %} {% include "tenders/_detail_cta.html" with tender=tender user_can_click=True siae_id=siae_id %} {% include "tenders/_detail_cta_cocontracting.html" with tender=tender siae_id=siae_id %} {% include "tenders/_detail_cta_not_interested.html" with tender=tender siae_id=siae_id %} @@ -126,7 +126,7 @@ {% endif %} {% comment %} for anonymous tenders {% endcomment %} {% elif tender.response_is_anonymous and siae_id or tender.response_is_anonymous and user.is_authenticated %} - {% if not (siae_has_detail_contact_click_date or siae_has_detail_not_interested_click_date) %} + {% if not siae_has_detail_contact_click_date %} {% include "tenders/_detail_cta.html" with tender=tender user_can_click=True tender_is_anonymous=True %} {% else %} {% include "tenders/_detail_success_contact.html" %} diff --git a/lemarche/tenders/models.py b/lemarche/tenders/models.py index 2df5037c5..a03dc865b 100644 --- a/lemarche/tenders/models.py +++ b/lemarche/tenders/models.py @@ -695,6 +695,10 @@ def siae_detail_contact_click_date_count(self): def siae_detail_cocontracting_click_date_count(self): return self.tendersiae_set.filter(detail_cocontracting_click_date__isnull=False).count() + @property + def siae_detail_not_interested_click_date_count(self): + return self.tendersiae_set.filter(detail_not_interested_click_date__isnull=False).count() + def get_absolute_url(self): return reverse("tenders:detail", kwargs={"slug": self.slug}) diff --git a/lemarche/www/tenders/views.py b/lemarche/www/tenders/views.py index a8950909e..d8425fec1 100644 --- a/lemarche/www/tenders/views.py +++ b/lemarche/www/tenders/views.py @@ -377,23 +377,14 @@ def get_context_data(self, **kwargs): context["siae_has_detail_contact_click_date"] = TenderSiae.objects.filter( tender=self.object, siae_id=int(self.siae_id), detail_contact_click_date__isnull=False ).exists() - context["siae_has_detail_not_interested_click_date"] = TenderSiae.objects.filter( - tender=self.object, siae_id=int(self.siae_id), detail_not_interested_click_date__isnull=False - ).exists() if user.is_authenticated: if user.kind == User.KIND_SIAE: context["siae_has_detail_contact_click_date"] = ( - context["siae_has_detail_contact_click_date"] + getattr(context, "siae_has_detail_contact_click_date", None) or TenderSiae.objects.filter( tender=self.object, siae__in=user.siaes.all(), detail_contact_click_date__isnull=False ).exists() ) - context["siae_has_detail_not_interested_click_date"] = ( - context["siae_has_detail_not_interested_click_date"] - or TenderSiae.objects.filter( - tender=self.object, siae__in=user.siaes.all(), detail_not_interested_click_date__isnull=False - ).exists() - ) if show_nps: context["show_nps"] = True elif user.kind == User.KIND_PARTNER: