Skip to content

Commit

Permalink
Fix logics
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Kysil authored and folix-01 committed Sep 27, 2024
1 parent b86b4c8 commit 12c1ce7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/redturtle/prenotazioni/restapi/services/booking/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def validate(self):
raise BadRequest(msg)

# booking.additional_fields validation below
additional_fields = data.get("additional_fields")
additional_fields = data.get("additional_fields") or []

# rewrite the fields to prevent not required data
additional_fields_data = []
Expand All @@ -185,8 +185,7 @@ def validate(self):
)
)[0]

for field_schema in booking_type.booking_additional_fields_schema:

for field_schema in booking_type.booking_additional_fields_schema or []:
field = list(
filter(
lambda i: i.get("name") == field_schema.get("name"),
Expand Down
4 changes: 2 additions & 2 deletions src/redturtle/prenotazioni/restapi/services/booking/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def handle_additional_fields(self):

if data:
# booking.additional_fields validation below
additional_fields = data.get("additional_fields")
additional_fields = data.get("additional_fields") or []

# rewrite the fields to prevent not required data
additional_fields_data = []
Expand All @@ -41,7 +41,7 @@ def handle_additional_fields(self):

booking_type = self.context.get_booking_type()

for field_schema in booking_type.booking_additional_fields_schema:
for field_schema in booking_type.booking_additional_fields_schema or []:
field = list(
filter(
lambda i: i.get("name") == field_schema.get("name"),
Expand Down

0 comments on commit 12c1ce7

Please sign in to comment.