-
Notifications
You must be signed in to change notification settings - Fork 18
[PROJ-1523] fix(place/auto_release): fix logic so email sends with negative time_… #586
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
[PROJ-1523] fix(place/auto_release): fix logic so email sends with negative time_… #586
Conversation
…before value The conditions were previously mutually exclusive with a negative time_before value, so the email would never send. We need to allow for negative values so the email can send X minutes after the meeting time but before the booking is released.
|
hey @chillfox can we get your review as you're the main author of this driver? |
|
When the time_before is set to a negative value, the conditions for sending the email skip the exact moment at which the email would be sent. By changing the sign to <=, that moment is included and the email should send. 1st condition:
|
chillfox
left a comment
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.
mostly looks good.
Just remove the end, run crystal tool format drivers/place/auto_release.cr to ensure consistent formatting. Make sure it compiles crystal build drivers/place/auto_release.cr and run the specs in the test harness to see if any needs to be changed with the change in logic.
drivers/place/auto_release.cr
Outdated
| (booking.booking_start - Time.utc.to_unix <= @auto_release.time_before(booking.booking_type) * 60) && | ||
| (Time.utc.to_unix - booking.booking_start <= @auto_release.time_after(booking.booking_type) * 60) | ||
| logger.debug { "sending release email to #{booking.user_email} for booking #{booking.id} as it is within the time_before window" } | ||
| 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.
This end should not be there.
|
OK, @chillfox I have removed the "end" and added a couple of test results to the spec file that it was expecting to see. It now passes the test harness. Please verify and merge if those changes are ok. |
chillfox
left a comment
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.
LGTM
Please run crystal tool format in the future, as it makes the diffs much easier to read for review.
The conditions were previously mutually exclusive with a negative time_before value, so the email would never send. We need to allow for negative values so the email can send X minutes after the meeting time but before the booking is released.