Skip to content

Commit

Permalink
fix: Addressbook already_taken_contacts
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-filicetti committed Jan 15, 2025
1 parent 3a3f11f commit 508a2ec
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions addressbook/api/v1/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def getAddressbook(
for p in priorita_tmp:
priorita.update({p["cd_ruolo"]: p["priorita"]})

# already_taken_contacts = []
already_taken_contacts = []
for q in query:
if q["id_ab"] not in grouped:
grouped[q["id_ab"]] = {
Expand Down Expand Up @@ -153,15 +153,15 @@ def getAddressbook(
]
if (
not bool(res)
# and q["personalecontatti__contatto"].lower()
# not in already_taken_contacts
and f'{q["personalecontatti__cd_tipo_cont__pk"].lower()}-{q["personalecontatti__contatto"].lower()}'
not in already_taken_contacts
):
grouped[q["id_ab"]][
q["personalecontatti__cd_tipo_cont__descr_contatto"]
].append(q["personalecontatti__contatto"])
# already_taken_contacts.append(
# q["personalecontatti__contatto"].lower()
# )
already_taken_contacts.append(
f'{q["personalecontatti__cd_tipo_cont__pk"].lower()}-{q["personalecontatti__contatto"].lower()}'
)

if last_id == -1 or last_id != q["id_ab"]:
last_id = q["id_ab"]
Expand Down Expand Up @@ -495,7 +495,7 @@ def getPersonale(personale_id, full=False):
roles.append(d_data)
roles.sort(key=lambda x: x["priorita"])

# already_taken_contacts = []
already_taken_contacts = []
for q in query:
for c in PERSON_CONTACTS_TO_TAKE:
q[c] = []
Expand All @@ -509,15 +509,15 @@ def getPersonale(personale_id, full=False):
]
if (
not bool(res)
# and c["personalecontatti__contatto"].lower()
# not in already_taken_contacts
and f'{c["personalecontatti__cd_tipo_cont__pk"].lower()}-{c["personalecontatti__contatto"].lower()}'
not in already_taken_contacts
):
q[c["personalecontatti__cd_tipo_cont__descr_contatto"]].append(
c["personalecontatti__contatto"]
)
# already_taken_contacts.append(
# c["personalecontatti__contatto"].lower()
# )
already_taken_contacts.append(
f'{c["personalecontatti__cd_tipo_cont__pk"].lower()}-{c["personalecontatti__contatto"].lower()}'
)

if len(functions) == 0:
q["Functions"] = None
Expand Down

0 comments on commit 508a2ec

Please sign in to comment.