Skip to content

Commit

Permalink
fix: bug
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-filicetti committed Dec 11, 2024
1 parent 08d19a4 commit 6d10787
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion addressbook/api/v1/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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') |
Expand Down
4 changes: 2 additions & 2 deletions addressbook/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion laboratories/api/v1/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
14 changes: 7 additions & 7 deletions teachers/api/v1/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 6d10787

Please sign in to comment.