diff --git a/Cerebrum/modules/hr_import/employee_import.py b/Cerebrum/modules/hr_import/employee_import.py index ed421084e..40c47ca00 100644 --- a/Cerebrum/modules/hr_import/employee_import.py +++ b/Cerebrum/modules/hr_import/employee_import.py @@ -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))