-
Notifications
You must be signed in to change notification settings - Fork 510
Link booking occurrences to events #6243
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
Link booking occurrences to events #6243
Conversation
34c3061 to
42f6955
Compare
8f38100 to
f84165a
Compare
0b93dc2 to
e61c064
Compare
1706604 to
bd1852d
Compare
|
@ThiefMaster this is ready for round 2. |
|
I'm busy preparing the 3.3 release atm, but maybe one of my colleagues can give it a try in the meantime :) |
indico/modules/rb/client/js/modules/calendar/CalendarListView.jsx
Outdated
Show resolved
Hide resolved
d400643 to
98eba97
Compare
@tomasr8 it's fixed now. It was redux stuff. |
| /> | ||
| ); | ||
| return ( | ||
| <div style={{position: 'absolute', top: '5px', right: '5px'}}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indico/modules/rb/client/js/modules/calendar/CalendarListView.jsx
Outdated
Show resolved
Hide resolved
| <Button | ||
| icon={<Icon name="linkify" />} | ||
| primary | ||
| disabled={!!booking.link || !datesMatch} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about not rendering the link button at all if it's not possible to link? If you have a lot of bookings, it could be hard to see the difference between active and disabled buttons since the shades of blue are pretty similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just removed rendering the button if it cannot be linked.
|
Should it be possible to unlink the booking as well? Since you can link with just a click w/o a confirmation I can imagine someone accidentally selecting the wrong booking. Or just add a confirmation dialog when selecting the booking? |
98eba97 to
b9ea67b
Compare
|
I made a few improvements while testing it and it's almost good to go, unfortunately there is still a rather nasty bug - I'll comment on the code about it since that way it'll be a separate comment thread. |
indico/modules/rb/client/js/modules/calendar/CalendarListView.jsx
Outdated
Show resolved
Hide resolved
Also use a tuple instead of a list in overlaps check
455abc8 to
0bcbe75
Compare
`check_access` is meant for access checks, not for general validation
|
Adding a short video demo: Screen.Recording.2024-05-16.at.18.21.37.mov |
| const boundaries = [moment(linkData.startDt), moment(linkData.endDt)]; | ||
| const datesMatch = | ||
| moment(booking.startDt).isBetween(...boundaries, undefined, '[]') && | ||
| moment(booking.endDt).isBetween(...boundaries, undefined, '[]'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this check may be too strict. IMHO it's reasonable to allow linking a booking that "contains" the event - e.g. when the booking is from 8:30-11:00 and the event is from 9:00-10:30.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @OmeGak
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And isn't that the case with the current code? I mean, if both the events's start and end dates are between the booking's timeframe, then the event's timeframe is inside the booking's, right?
EDIT: is it just me or... the current code is exactly the other way around? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, the current logic requires that both conditions are met:
- the occurrence start is between the start/end date of the event
- the occurrence end is between the start/end date of the event
However, I think what we need is a check that:
- the occurrence start is <= the event start
- the occurrence end is >= the event end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe even have a general "time ranges overlap" check since you may want to link multiple occurrences that are used for the event even though neither of them fully contains the event?
That would be (StartOccurrence < EndEvent) and (EndOccurrence > StartEvent)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does not work. Imagine the following:
Event: 10::00 - 12:00.
Occurrence: 11:00 - 16:00.
Using your formula:
11:00 < 12:00 and 16:00 > 10:00
Yet between 10:00 and 11:00 there's an event but there's no booking.




This PR links booking occurrences with events.
Screenshots