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 /schedule/current when the schedule spans midnight #618

Merged
merged 2 commits into from
Aug 25, 2021

Conversation

stefanor
Copy link
Member

When a schedule spans midnight, /schedule/current displays the last talk from the previous day, every day.
It's still based on the old separate date and time from ScheduleDay and ScheduleBlock, in its logic, the migration was incomplete here.

Fix the bug, and refactor the code to use a single timestamp query parameter for testing.

Now that ScheduleBlocks can span midnight, we need to be concerned about
both date and time.
@stefanor stefanor merged commit 5e2883e into master Aug 25, 2021
@stefanor stefanor deleted the current-page-timestamp branch August 25, 2021 20:17
timestamp = parse_datetime(timestamp)
except ValueError as e:
messages.error(self.request,
'Failed to parse timestamp: %s' % e)
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 there is a mistake in the error handling logic here. If the timestamp fails to parse, it will remain with its non-None original value (probably a string, I guess) and fail on if not timezone.is_aware(timestamp) I presume.

The simplest fix appears to be to return None at the end of the exception block.

It also seems like a good idea to not overwrite the timestamp though so that the timestamp can be reported in the error message in the if timestamp is None block.

It looks like the tests don't cover invalid timestamps, which explains how these made it through CI.

drnlm pushed a commit to drnlm/wafer that referenced this pull request Oct 17, 2023
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