13 lines
293 B
Ruby
13 lines
293 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Captain::Lifecycle::Guards::MaxPerReservation < Captain::Lifecycle::Guards::Base
|
|
CAP = 5
|
|
|
|
def check
|
|
count = Captain::Lifecycle::Delivery.count_sent_for_reservation(@reservation.id)
|
|
return skip('max_reached') if count >= CAP
|
|
|
|
pass
|
|
end
|
|
end
|