diff --git a/Cerebrum/modules/fs/import_fs.py b/Cerebrum/modules/fs/import_fs.py index 19031a1fc..d111c1ab8 100644 --- a/Cerebrum/modules/fs/import_fs.py +++ b/Cerebrum/modules/fs/import_fs.py @@ -84,6 +84,10 @@ def __init__(self, gen_groups, include_delete, commit, self.commit = commit self.source = source + self.disregard_grace_for_affs = [ + int(self.co.human2constant(x)) for x in + cereconf.FS_EXCLUDE_AFFILIATIONS_FROM_GRACE] + def init_reservation_group(self): """ get callbacks to add/remove members in reservation group """ group_name = cereconf.FS_GROUP_NAME @@ -361,7 +365,7 @@ def _db_add_person(self, person, person_info, pd): aff_status) if self.include_delete: key_a = "%s:%s:%s" % (person.entity_id, ou, int(aff)) - if key_a in self.old_aff: + if key_a in self.old_aff and int(aff_status) not in self.disregard_grace_for_affs: self.old_aff[key_a] = False self._register_cellphone(person, person_info) @@ -606,10 +610,6 @@ def rem_old_aff(self, spare_active_account_affs=False): they are. """ - disregard_grace_for_affs = [ - int(self.co.human2constant(x)) for x in - cereconf.FS_EXCLUDE_AFFILIATIONS_FROM_GRACE] - logger.info("Removing old FS affiliations") stats = defaultdict(lambda: 0) person = Factory.get("Person")(self.db) @@ -617,6 +617,7 @@ def rem_old_aff(self, spare_active_account_affs=False): for k in self.old_aff: if not self.old_aff[k]: # Aff still present in import files + #TODO: Checking if an affiliation is valid might still be important even if it exists in important files? continue person_id, ou_id, aff_id = (int(val) for val in k.split(':')) @@ -646,7 +647,7 @@ def rem_old_aff(self, spare_active_account_affs=False): grace_days = cereconf.FS_STUDENT_REMOVE_AFF_GRACE_DAYS if (get_date(aff['last_date']) > (date.today() - timedelta(days=grace_days)) and - int(aff['status']) not in disregard_grace_for_affs): + int(aff['status']) not in self.disregard_grace_for_affs): logger.debug("Sparing aff (%s) for person_id=%r at ou_id=%r," " grace-period in effect",aff_id, person_id, ou_id) stats['grace'] += 1 diff --git a/contrib/no/uio/import_FS.py b/contrib/no/uio/import_FS.py index 9a1d2ab1f..e7dc45b48 100644 --- a/contrib/no/uio/import_FS.py +++ b/contrib/no/uio/import_FS.py @@ -190,7 +190,6 @@ def _get_person_data(self, person_info, fnr): continue # Get name if dta_type in ( - 'fagperson', 'opptak', 'tilbud', 'evu', @@ -211,17 +210,7 @@ def _get_person_data(self, person_info, fnr): if 'personlopenr' in p: personlopenr = p['personlopenr'] # Get affiliations - if dta_type in ('fagperson',): - self._process_affiliation( - self.co.affiliation_tilknyttet, - self.co.affiliation_tilknyttet_fagperson, - affiliations, - self._get_sko(p, - 'faknr', - 'instituttnr', - 'gruppenr', - 'institusjonsnr')) - elif dta_type in ('opptak',): + if dta_type in ('opptak',): for row in x: subtype = self.co.affiliation_status_student_opptak if (self.studieprog2sko[row['studieprogramkode']] @@ -429,7 +418,6 @@ def main(): Cerebrum.logutils.autoconf('cronjob', args) rules = [ - ('fagperson', ('_arbeide', '_hjemsted', '_besok_adr')), ('aktiv', ('_semadr', '_hjemsted', None)), ('emnestud', ('_semadr', '_hjemsted', None)), ('evu', ('_job', '_hjem', None)), @@ -442,8 +430,6 @@ def main(): 'aktiv': 'opptak' } adr_map = { - '_arbeide': ('adrlin1_arbeide', 'adrlin2_arbeide', 'adrlin3_arbeide', - 'postnr_arbeide', 'adresseland_arbeide'), '_hjemsted': ('adrlin1_hjemsted', 'adrlin2_hjemsted', 'adrlin3_hjemsted', 'postnr_hjemsted', 'adresseland_hjemsted'), @@ -452,8 +438,7 @@ def main(): '_job': ('adrlin1_job', 'adrlin2_job', 'adrlin3_job', 'postnr_job', 'adresseland_job'), '_hjem': ('adrlin1_hjem', 'adrlin2_hjem', 'adrlin3_hjem', - 'postnr_hjem', 'adresseland_hjem'), - '_besok_adr': ('institusjonsnr', 'faknr', 'instituttnr', 'gruppenr') + 'postnr_hjem', 'adresseland_hjem') } fs_importer = FsImporterUio(args.gen_groups, args.include_delete, args.commit, diff --git a/contrib/no/uio/import_from_FS.py b/contrib/no/uio/import_from_FS.py index c481e9097..4b9066e65 100755 --- a/contrib/no/uio/import_from_FS.py +++ b/contrib/no/uio/import_from_FS.py @@ -227,13 +227,6 @@ def write_person_info(self, person_file): f.write( xml.xmlify_dbrow(d, xml.conv_colnames(cols), 'drgrad') + "\n") - # Fagpersoner - cols, fagpersoner = self._ext_cols( - self.fs.undervisning.list_fagperson_semester()) - for p in fagpersoner: - f.write( - xml.xmlify_dbrow( - p, xml.conv_colnames(cols), 'fagperson') + "\n") # Studenter med opptak, privatister (=opptak i studiepgraommet # privatist) og Alumni