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

Overlaps_with is wrong when one proposal has a potential time and the other does not #1566

Closed
Jonty opened this issue May 19, 2024 · 2 comments

Comments

@Jonty
Copy link
Member

Jonty commented May 19, 2024

proposal.overlaps_with is clearly incorrect when one proposal has a potential time and the other does not:

Website/models/cfp.py

Lines 728 to 735 in c417d32

def overlaps_with(self, other) -> bool:
if self.potential_start_date:
return (
self.potential_end_date > other.potential_start_date
and other.potential_end_date > self.potential_start_date
)
else:
return self.end_date > other.start_date and other.end_date > self.start_date

This is because we introduced potential times after overlaps_with, and when we did every proposal would have a potential time. These days this is very occasionally no longer true if someone moves something in the schedule tweaker.

The only places this surfaces is in the clashfinder or in the attendee content interface to warn them when they are scheduling something against content in their village.

Arguably attendees shouldn't know about this, but we should pay attention to it in the clashfinder. Not sure what the "correct" fix is. This is in no way critical.

@Jonty
Copy link
Member Author

Jonty commented May 21, 2024

After taking a quick look the reason the clashfinder is currently broken is entirely because this function is wrong.

    if prop1.overlaps_with(prop2):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/models/cfp.py", line 735, in overlaps_with
    return self.end_date > other.start_date and other.end_date > self.start_date
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '>' not supported between instances of 'datetime.datetime' and 'NoneType'

Slightly puzzled as to how this can even happen though - the only content visible on the lineup right now is content that has been scheduled and thus should have start and end times. The clashfinder only looks at things that have been favourited, which means they have to be on the schedule. Regardless, it sucks.

@Jonty
Copy link
Member Author

Jonty commented May 21, 2024

Ah, withdrawn content can have favourites but not be scheduled 🫠

@Jonty Jonty closed this as completed in e8fe5c0 May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant