Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Jan 16, 2024
1 parent 374239f commit 42f0952
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
10 changes: 7 additions & 3 deletions lemarche/templates/tenders/_detail_admin_extra_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,24 @@ <h2 class="h3">Informations Admin</h2>
{{ tender.siae_email_send_date_count }} prestataire{{ tender.siae_email_send_date_count|pluralize }} ciblé{{ tender.siae_email_send_date_count|pluralize }}
</li>
<li class="mb-2">
<i class="ri-focus-2-line"></i>
<i class="ri-eye"></i>
{{ 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
</li>
<li class="mb-2">
<i class="ri-thumb-up-line"></i>
{{ 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 }}
</li>
<li class="mb-2">
<i class="ri-thumb-down-line"></i>
{{ 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 }}
</li>
{% if not tender.deadline_date_outdated %}
<li class="mb-2">
Transactionné :
{% if tender.siae_transactioned == None %}
Inconnu
inconnu
{% else %}
{{ tender.siae_transactioned.value|yesno:"Oui,Non" }}
{{ tender.siae_transactioned.value|yesno:"✅,❌" }}
{% endif %}
</li>
{% endif %}
Expand Down
6 changes: 3 additions & 3 deletions lemarche/templates/tenders/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@
Besoin d'aide ? contacter le support via le chat en ligne qui se trouve en bas à droite.
</p>
</div>
{% 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 %}
{% endif %}
{% 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 %}
Expand All @@ -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" %}
Expand Down
4 changes: 4 additions & 0 deletions lemarche/tenders/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down
11 changes: 1 addition & 10 deletions lemarche/www/tenders/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 42f0952

Please sign in to comment.