Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fixed timeslots for bookable #69

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Pingviinituutti
Copy link
Contributor

@Pingviinituutti Pingviinituutti commented Oct 22, 2020

Here's a first version of how the fixed timeslots could work for bookables, according to enhancement #46.

This adds a new field in the admin form. The form is populated with javascript and changes are updated to the text input. If someone knows how to do it in a Django way, feel free to change it.
image

Features still to do: only suggest the bookable timeslots in the booking form when an user makes a booking.

Also, pls add the hacktoberfest-accepted label to this PR :D

Copy link
Collaborator

@tlangens tlangens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a JSON field, I would suggest a separate table with a FK to bookable.
Also instead of end date I would suggest a duration, otherwise there might be issues with DST. Then again I'm not sure what the booking rules for TF's bookables says about DST.

@Pingviinituutti
Copy link
Contributor Author

Instead of a JSON field, I would suggest a separate table with a FK to bookable.
Also instead of end date I would suggest a duration, otherwise there might be issues with DST. Then again I'm not sure what the booking rules for TF's bookables says about DST.

There! I still kept the end date, because normal bookings also use the end date instead of the duration. This should work if TF's normal booking rules work with DST.

Comment on lines +68 to +69
if Timeslot.objects.filter(bookable=self).count() > 0: return True
return False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if Timeslot.objects.filter(bookable=self).count() > 0: return True
return False
return Timeslot.objects.filter(bookable=self).count() > 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants