Skip to content

Commit

Permalink
Fix a date issue in the dfo import
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikhl committed Jan 26, 2023
1 parent 10ec59d commit a51e92a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Cerebrum/modules/hr_import/employee_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,11 @@ def _update_affiliations(self, db_person, hr_person, _today=None):
"""Update person in Cerebrum with the latest affiliations"""
today = _today or datetime.date.today()
aff_tuples = []
for aff, ou_idents, start, end in hr_person.affiliations:
# TODO: Apply grace here?
if start and start > today or end and end < today:
continue

# TODO: This is slightly wrong - we shouldn't rely on a dfo-specific
# mapper function here...
for aff, ou_idents in self._mapper.get_active_affiliations(hr_person,
_today=today):
ou = self._get_ou(ou_idents)
if not ou:
raise NonExistentOuError("invalid ou: " + repr(ou_idents))
Expand Down

0 comments on commit a51e92a

Please sign in to comment.