Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions drivers/place/auto_release.cr
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,9 @@ class Place::AutoRelease < PlaceOS::Driver

# convert minutes (time_after) to seconds for comparison with unix timestamps (booking_start)
if enabled? &&
(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 withing the time_before window" }
(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" }

location = Time::Location.load(booking.timezone.presence || timezone.name)
starting = Time.unix(booking.booking_start).in(location)
Expand Down
2 changes: 2 additions & 0 deletions drivers/place/auto_release_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,7 @@ DriverSpecs.mock_driver "Place::AutoRelease" do
resp = exec(:pending_release).get
pending_release = resp.not_nil!.as_a.map(&.as_h["title"])
pending_release.should eq [
"ignore_after_hours",
"notify_created_yesterday",
"reject_created_yesterday",
"outside_hours",
Expand Down Expand Up @@ -1141,6 +1142,7 @@ DriverSpecs.mock_driver "Place::AutoRelease" do
resp = exec(:pending_release).get
pending_release = resp.not_nil!.as_a.map(&.as_h["title"])
pending_release.should eq [
"ignore_after_hours",
"notify_created_yesterday",
"reject_created_yesterday",
"outside_hours",
Expand Down
Loading