From 987a58a578179dafe4e70bef1940e71bb9a9d1e5 Mon Sep 17 00:00:00 2001 From: Vermeer GRANGE Date: Thu, 23 Dec 2021 17:38:16 +0200 Subject: [PATCH] Fix error by avoiding having tz aware values in df --- itou/siaes/management/commands/_import_siae/vue_af.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/itou/siaes/management/commands/_import_siae/vue_af.py b/itou/siaes/management/commands/_import_siae/vue_af.py index d67fc6afeb..1d6155cdf1 100644 --- a/itou/siaes/management/commands/_import_siae/vue_af.py +++ b/itou/siaes/management/commands/_import_siae/vue_af.py @@ -79,10 +79,7 @@ def get_vue_af_df(): assert row.kind in Siae.ASP_MANAGED_KINDS validate_af_number(row.number) - df["start_at"] = df.start_at.apply(timezone.make_aware) - df["end_date"] = df.end_date.apply(timezone.make_aware) - - df["ends_in_the_future"] = df.end_date > timezone.now() + df["ends_in_the_future"] = df.end_date.apply(timezone.make_aware) > timezone.now() df["has_active_state"] = df.state.isin(SiaeFinancialAnnex.STATES_ACTIVE) df["is_active"] = df.has_active_state & df.ends_in_the_future @@ -169,5 +166,5 @@ def get_siae_key_to_convention_end_date(): ACTIVE_SIAE_KEYS = [ siae_key for siae_key, convention_end_date in get_siae_key_to_convention_end_date().items() - if timezone.now() < convention_end_date + if timezone.now() < timezone.make_aware(convention_end_date) ]