Skip to content

Commit

Permalink
Merge branch 'vgrange/fix_import_siae'
Browse files Browse the repository at this point in the history
* vgrange/fix_import_siae:
  Fix error by avoiding having tz aware values in df
  • Loading branch information
dejafait committed Dec 23, 2021
2 parents 316424c + 987a58a commit cd4013f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions itou/siaes/management/commands/_import_siae/vue_af.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
]

0 comments on commit cd4013f

Please sign in to comment.