Skip to content

Conversation

@moliholy
Copy link
Contributor

This PR links booking occurrences with events.

Screenshots

Screenshot 2024-03-20 at 17 36 14 Screenshot 2024-03-20 at 17 36 30

@moliholy moliholy force-pushed the booking-occurrence-linking branch 4 times, most recently from 34c3061 to 42f6955 Compare March 21, 2024 11:16
@moliholy moliholy marked this pull request as ready for review March 21, 2024 11:17
@moliholy moliholy force-pushed the booking-occurrence-linking branch 4 times, most recently from 8f38100 to f84165a Compare March 21, 2024 11:47
@moliholy moliholy changed the title link booking occurrencies to events link booking occurrences to events Mar 21, 2024
@moliholy moliholy changed the title link booking occurrences to events Link booking occurrences to events Mar 21, 2024
@moliholy moliholy force-pushed the booking-occurrence-linking branch 2 times, most recently from 0b93dc2 to e61c064 Compare March 21, 2024 12:59
@moliholy moliholy force-pushed the booking-occurrence-linking branch from 1706604 to bd1852d Compare March 25, 2024 10:59
@moliholy
Copy link
Contributor Author

@ThiefMaster this is ready for round 2.

@ThiefMaster ThiefMaster requested a review from tomasr8 March 26, 2024 13:42
@ThiefMaster
Copy link
Member

I'm busy preparing the 3.3 release atm, but maybe one of my colleagues can give it a try in the meantime :)

@tomasr8
Copy link
Member

tomasr8 commented Mar 26, 2024

I'm getting this error when linking a booking:
image
The booking still gets linked though 🤔

@moliholy moliholy force-pushed the booking-occurrence-linking branch 2 times, most recently from d400643 to 98eba97 Compare March 30, 2024 14:03
@moliholy
Copy link
Contributor Author

I'm getting this error when linking a booking:

@tomasr8 it's fixed now. It was redux stuff.

/>
);
return (
<div style={{position: 'absolute', top: '5px', right: '5px'}}>
Copy link
Member

Choose a reason for hiding this comment

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

With longer room names, there's an overlap between them and the link button:
image

Copy link
Contributor Author

@moliholy moliholy Apr 5, 2024

Choose a reason for hiding this comment

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

I moved it a bit down so that it does not overlap.

Screenshot 2024-04-05 at 09 16 18

<Button
icon={<Icon name="linkify" />}
primary
disabled={!!booking.link || !datesMatch}
Copy link
Member

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.

Copy link
Contributor Author

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.

@tomasr8
Copy link
Member

tomasr8 commented Apr 2, 2024

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?

@moliholy moliholy force-pushed the booking-occurrence-linking branch from 98eba97 to b9ea67b Compare April 5, 2024 07:12
@moliholy
Copy link
Contributor Author

moliholy commented Apr 5, 2024

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?

I just added a modal to confirm the linking operation.

Screenshot 2024-04-05 at 09 54 45

@ThiefMaster
Copy link
Member

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.

@ThiefMaster ThiefMaster force-pushed the booking-occurrence-linking branch from 455abc8 to 0bcbe75 Compare May 3, 2024 12:35
@ThiefMaster ThiefMaster added this to the v3.3 milestone May 3, 2024
`check_access` is meant for access checks, not for general validation
@ThiefMaster ThiefMaster merged commit aac9e4f into indico:master May 3, 2024
@OmeGak
Copy link
Member

OmeGak commented May 16, 2024

Adding a short video demo:

Screen.Recording.2024-05-16.at.18.21.37.mov

Comment on lines +151 to +154
const boundaries = [moment(linkData.startDt), moment(linkData.endDt)];
const datesMatch =
moment(booking.startDt).isBetween(...boundaries, undefined, '[]') &&
moment(booking.endDt).isBetween(...boundaries, undefined, '[]');
Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

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

cc @OmeGak

Copy link
Contributor Author

@moliholy moliholy May 31, 2024

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? 🤔

Copy link
Member

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

Copy link
Member

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)

Copy link
Contributor Author

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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants