diff --git a/addressbook/api/v1/services.py b/addressbook/api/v1/services.py index 7aa79cb8..c259fdb0 100644 --- a/addressbook/api/v1/services.py +++ b/addressbook/api/v1/services.py @@ -366,7 +366,7 @@ def getPersonale(personale_id, full=False): Q(didatticacopertura__aa_off_id=datetime.datetime.now().year - 1) & ~Q(didatticacopertura__stato_coper_cod='R') ) else: - personale_id = get_personale_data(personale_id)['matricola'] + personale_id = get_personale_data(personale_id) query = Personale.objects.filter( Q(flg_cessato=0) | Q(didatticacopertura__aa_off_id=datetime.datetime.now().year) & ~Q(didatticacopertura__stato_coper_cod='R') | diff --git a/addressbook/utils.py b/addressbook/utils.py index f69e76e9..a102f652 100644 --- a/addressbook/utils.py +++ b/addressbook/utils.py @@ -11,7 +11,7 @@ def get_personale_data(personale_id, field_to_retrieve='matricola'): if personale_id[len(personale_id) - 2:] == "==": - return {'matricola': decrypt(personale_id)} + return decrypt(personale_id) personale_model = apps.get_model("addressbook.Personale") personalecontatti_model = apps.get_model("addressbook.PersonaleContatti") @@ -26,7 +26,7 @@ def get_personale_data(personale_id, field_to_retrieve='matricola'): ) if not personale: raise Http404 - return personale["matricola"] + return personale[field_to_retrieve] def append_email_addresses(addressbook_queryset, id_ab_key): diff --git a/laboratories/api/v1/services.py b/laboratories/api/v1/services.py index efb6f255..fbc43aa3 100644 --- a/laboratories/api/v1/services.py +++ b/laboratories/api/v1/services.py @@ -35,7 +35,7 @@ def getLaboratoriesList( is_active=True, ): if teacher: - teacher = get_personale_data(teacher)['matricola'] + teacher = get_personale_data(teacher) query_search = Q() query_ambito = Q() diff --git a/teachers/api/v1/services.py b/teachers/api/v1/services.py index 4ed7229b..37855600 100644 --- a/teachers/api/v1/services.py +++ b/teachers/api/v1/services.py @@ -45,7 +45,7 @@ class ServiceDocente: @staticmethod def getAllResearchGroups(search, teacher, department, cod): if teacher: - teacher = get_personale_data(teacher)['matricola'] + teacher = get_personale_data(teacher) query_search = Q() query_cod = Q() @@ -141,7 +141,7 @@ def getAllResearchGroups(search, teacher, department, cod): @staticmethod def getResearchLines(teacher_id, only_active=True): - teacher_id = get_personale_data(teacher_id)['matricola'] + teacher_id = get_personale_data(teacher_id) query_is_active_app = ( Q(ricercadocentelineaapplicata__ricerca_linea_applicata__visibile=True) @@ -788,7 +788,7 @@ def teachingCoveragesList(search, regdid, dip, role, cds, year): @staticmethod def getAttivitaFormativeByDocente(teacher, year, yearFrom, yearTo): - teacher = get_personale_data(teacher)['matricola'] + teacher = get_personale_data(teacher) if year: query = DidatticaCopertura.objects.filter( @@ -863,7 +863,7 @@ def getAttivitaFormativeByDocente(teacher, year, yearFrom, yearTo): @staticmethod def getDocenteInfo(teacher, use_this_id=False): if not use_this_id: - teacher = get_personale_data(teacher)['matricola'] + teacher = get_personale_data(teacher) query = Personale.objects.filter( Q(fl_docente=1, flg_cessato=0) @@ -1003,7 +1003,7 @@ def getDocenteInfo(teacher, use_this_id=False): @staticmethod def getDocenteMaterials(user, teacher, search=None): - teacher = get_personale_data(teacher)['matricola'] + teacher = get_personale_data(teacher) query_search = Q() query_is_active = Q(attivo=True) @@ -1051,7 +1051,7 @@ def getDocenteMaterials(user, teacher, search=None): @staticmethod def getDocenteNews(user, teacher, search=None): - teacher = get_personale_data(teacher)['matricola'] + teacher = get_personale_data(teacher) query_search = Q() query_is_active = Q(attivo=True) @@ -1112,7 +1112,7 @@ def getPublicationsList( teacherid=None, search=None, year=None, pub_type=None, structure=None ): if teacherid: - teacherid = get_personale_data(teacherid, 'cod_fis')['cod_fis'] + teacherid = get_personale_data(teacherid, 'cod_fis') query_search = Q() query_year = Q()