Skip to content

Commit

Permalink
Use siae.is_subject_to_eligibility_rules
Browse files Browse the repository at this point in the history
  • Loading branch information
dejafait committed Nov 20, 2020
1 parent 96f71e9 commit c1e123c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions itou/siaes/management/commands/import_siae.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def update_siae_siret(self, siae, new_siret):
def update_siret_and_auth_email_of_existing_siaes(self):
auth_email_updates = 0
for siae in Siae.objects.select_related("convention").filter(source=Siae.SOURCE_ASP, convention__isnull=False):
assert siae.kind in Siae.ELIGIBILITY_REQUIRED_KINDS
assert siae.is_subject_to_eligibility_rules

asp_id = siae.asp_id
row = ASP_ID_TO_SIAE_ROW.get(asp_id)
Expand Down Expand Up @@ -189,7 +189,7 @@ def create_new_siaes(self):
# Siaes with this asp_id already exist, no need to create one more.
total_existing_siae_with_asp_source = 0
for existing_siae in existing_siae_query.all():
assert existing_siae.kind in Siae.ELIGIBILITY_REQUIRED_KINDS
assert existing_siae.is_subject_to_eligibility_rules
if existing_siae.source == Siae.SOURCE_ASP:
total_existing_siae_with_asp_source += 1
if not self.dry_run:
Expand All @@ -210,7 +210,7 @@ def create_new_siaes(self):
assert self.dry_run
continue
assert existing_siae.source in [Siae.SOURCE_USER_CREATED, Siae.SOURCE_STAFF_CREATED]
assert existing_siae.kind in Siae.ELIGIBILITY_REQUIRED_KINDS
assert existing_siae.is_subject_to_eligibility_rules
self.log(
f"siae.id={existing_siae.id} already exists "
f"with wrong source={existing_siae.source} "
Expand Down
2 changes: 1 addition & 1 deletion itou/siaes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def display_name(self):

@property
def is_active(self):
if self.kind not in Siae.ELIGIBILITY_REQUIRED_KINDS:
if not self.is_subject_to_eligibility_rules:
# GEIQ, EA... have no convention logic and thus are always active.
return True
if self.source in [Siae.SOURCE_USER_CREATED, Siae.SOURCE_STAFF_CREATED]:
Expand Down

0 comments on commit c1e123c

Please sign in to comment.