working_helpers.rb 477 B

123456789101112131415
  1. module WorkingHelpers
  2. extend ActiveSupport::Concern
  3. def event_created_within?(days)
  4. last_event_at && last_event_at > days.to_i.days.ago
  5. end
  6. def recent_error_logs?
  7. last_event_at && last_error_log_at && last_error_log_at > (last_event_at - 2.minutes)
  8. end
  9. def received_event_without_error?
  10. (last_receive_at.present? && last_error_log_at.blank?) || (last_receive_at.present? && last_error_log_at.present? && last_receive_at > last_error_log_at)
  11. end
  12. end