diff --git a/lemarche/siaes/management/commands/sync_with_emplois_inclusion.py b/lemarche/siaes/management/commands/sync_with_emplois_inclusion.py index 6c711c839..479127947 100644 --- a/lemarche/siaes/management/commands/sync_with_emplois_inclusion.py +++ b/lemarche/siaes/management/commands/sync_with_emplois_inclusion.py @@ -79,15 +79,6 @@ def set_is_active(siae): return True -def set_is_delisted(siae): - """ - le-marche field - Helps to track the number of Siae who were set from active to inactive during a sync. - """ - is_active = set_is_active(siae) - return not is_active - - class Command(BaseCommand): """ This command syncs the list of siae (creates new, updates existing) from les-emplois to le-marché. @@ -180,10 +171,14 @@ def c1_export(self): # noqa C901 "source": c1_siae["source"], "is_active": set_is_active(c1_siae), "asp_id": c1_siae["convention_asp_id"], - "is_delisted": set_is_delisted(c1_siae), "c1_last_sync_date": timezone.now(), } + # make sure that non active siae are delisted as well + # but done seperately, because some active siae can be delisted + if not c1_siae_cleaned["is_active"]: + c1_siae_cleaned["is_delisted"] = True + # set coords from latitude & longitude c1_siae_cleaned["address"] = c1_siae_cleaned["address_line_1"] if c1_siae_cleaned["address_line_2"]: