Skip to content

Commit

Permalink
Resect hidden types from bookign schema
Browse files Browse the repository at this point in the history
  • Loading branch information
folix-01 committed Oct 13, 2023
1 parent 39073d2 commit c00a081
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Changelog
2.1.3 (unreleased)
------------------

- Nothing changed yet.
- Resect hiddent booking types from @booking-schema.
[folix-01]


2.1.2 (2023-10-13)
Expand Down
15 changes: 13 additions & 2 deletions src/redturtle/prenotazioni/restapi/services/booking_schema/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ def reply(self):
}
)

return {"fields": fields_list, "booking_types": self.get_booking_types()}
return {
"fields": fields_list,
"booking_types": self.get_booking_types(),
}

def get_booking_types(self):
booking_date = self.request.form.get("booking_date", None)
Expand All @@ -123,7 +126,9 @@ def get_booking_types(self):
return res

booking_context_state_view = api.content.get_view(
"prenotazioni_context_state", context=self.context, request=self.request
"prenotazioni_context_state",
context=self.context,
request=self.request,
)

# fix timezone notation. querystring replaced + with a space
Expand All @@ -136,4 +141,10 @@ def get_booking_types(self):
res["bookable"].append(item)
else:
res["unbookable"].append(item)

if api.user.has_permission("redturtle.prenotazioni.ViewHiddenTypes"):
return res

res["bookable"] = [t for t in res["bookable"] if not t.get("hidden")]

return res

0 comments on commit c00a081

Please sign in to comment.