Class: Ecom::Core::SiteCrew

Inherits:
ApplicationRecord show all
Defined in:
app/models/ecom/core/site_crew.rb

Constant Summary collapse

TEMPORARY_SITE_CREW =
'Temporary site crew'.freeze
PERMANENT_SITE_CREW =
'Permanent site crew'.freeze
SITE_CREW_TYPES =
[TEMPORARY_SITE_CREW, PERMANENT_SITE_CREW].freeze
ACTIVE =
'Active'.freeze
INACTIVE =
'Inactive'.freeze
STATUSES =
[ACTIVE, INACTIVE].freeze

Instance Method Summary collapse

Instance Method Details

#active_site_crew_exists?Boolean

Returns:

  • (Boolean)


26
27
28
29
30
31
32
# File 'app/models/ecom/core/site_crew.rb', line 26

def active_site_crew_exists?
  active_site_crew = Ecom::Core::SiteCrew.where(site_id: site_id, crew_id: crew_id, status: ACTIVE)

  return true if !active_site_crew.count.zero? && status == ACTIVE

  false
end