Skip to content

Commit

Permalink
Fix: term values must be unique in booking_type vocabulary (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
mamico authored Jan 25, 2024
1 parent 7e740f5 commit e84f250
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changelog
1.2.2 (unreleased)
------------------

- Fix: term values must be unique in booking_type vocabulary
[mamico]

- Workaround per booking_type con caratteri encodati due volte
[mamico]

Expand Down
11 changes: 5 additions & 6 deletions src/design/plone/ioprenoto/vocabularies/tipologies.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ def __call__(self, context):
if prenotazioni_folder and api.user.has_permission(
"View", obj=prenotazioni_folder
):
terms.extend(
[
self.booking_type2term(booking_type)
for booking_type in prenotazioni_folder.get_booking_types()
]
)
for booking_type in prenotazioni_folder.get_booking_types():
term = self.booking_type2term(booking_type)
if term.value not in [t.value for t in terms]:
terms.append(term)
terms.sort(key=lambda x: x.title)
return SimpleVocabulary(terms)


Expand Down

0 comments on commit e84f250

Please sign in to comment.