Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Besoins): Exclure les structures OPCS du matching #1130

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions lemarche/siaes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,15 @@ def prefetch_many_to_many(self):
def prefetch_many_to_one(self):
return self.prefetch_related("offers", "client_references", "labels_old", "images")

def api_query_set(self):
return self.exclude(kind="OPCS")

def search_query_set(self):
return self.is_live().exclude(kind="OPCS").prefetch_many_to_many()

def tender_matching_query_set(self):
return self.is_live().exclude(kind="OPCS").has_contact_email().prefetch_related("sectors")

def api_query_set(self):
return self.exclude(kind="OPCS")

def filter_siret_startswith(self, siret):
return self.filter(siret__startswith=siret)

Expand Down Expand Up @@ -347,7 +350,7 @@ def filter_with_tender(self, tender, tendersiae_status=None): # noqa C901
Args:
tender (Tender): Tender used to make the matching
"""
qs = self.prefetch_related("sectors").is_live().has_contact_email()
qs = self.tender_matching_query_set()
# filter by sectors
if tender.sectors.count():
qs = qs.filter_sectors(tender.sectors.all())
Expand Down
Loading