iachat/enterprise/app/services/captain/lifecycle/guards/max_per_reservation.rb
2026-04-15 01:42:10 -03:00

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