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

Fix conflicting bookings login filter #40

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aileo
Copy link
Contributor

@aileo aileo commented Feb 23, 2024

Hi,

I found out that when selecting a time range overlapping user's existing booking and someone else's booking on a seat, the delete action deletes both bookings.

I think the cause is in WarpSeatFactory.getMyConflictingBookings :

!i.book.login == this.login casts i.book.login as boolean first then compare its opposite value to this.login.

i.book.login != this.login checks if values are different.

Another way to do it could be !(i.book.login == this.login)

@Anbcorp
Copy link

Anbcorp commented May 16, 2024

Hello,

I tested this fix locally with docker-compose and it seems to fix the issue.

Thanks,

@sebo-b
Copy link
Owner

sebo-b commented Jun 14, 2024

Hi @aileo

I'm looking for a maintainer for this project, as I've not been able to spend much time on it recently. It seems that you have contributed a lot so far, so please let me know if you are interested.

Regards,
/S

@aileo
Copy link
Contributor Author

aileo commented Nov 29, 2024

Hi @sebo-b,

I would be happy to help but I am not a python dev so it seems a bit over the top to me.

I hope you find someone to take over

@sebo-b
Copy link
Owner

sebo-b commented Nov 29, 2024 via email

@aileo
Copy link
Contributor Author

aileo commented Nov 29, 2024

I had a quick look at it, here are the steps:

  • user1 books from 6:00 to 9:00
  • user2 books from 3:00 to 6:00
  • user2 tries to book from 2:00 to 8:00

without fix:

  • it says it will remove both 3:00 to 6:00 (user2) and 6:00 to 9:00 (user1)
  • fails to delete reservations and display an error (102) if user2 is not an admin

with this fix:

  • it says it will delete only 3:00 to 6:00 (even if user2 is an admin)
  • actually delete the reservation

Anyway, the condition !i.book.login == this.login will always be false in javascript as it first casts i.book.login to a boolean before comparing to this.login. As an example from the node console:

> !'foo' == 'bar';
false
> 'foo' != 'bar';
true

Let me know if you want some modification in the PR.

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.

3 participants