Class: SchedulerBookingPage
Overview
== Schema Information
Table name: scheduler_booking_pages
Database name: primary
id :bigint not null, primary key
active :boolean default(TRUE), not null
buffer_after_minutes :integer default(0), not null
buffer_before_minutes :integer default(0), not null
color :string
description :text
duration_minutes :integer default(30), not null
host_assignment_strategy :string default("single"), not null
invite_customer_sales_rep :boolean default(FALSE), not null
location_type :string default("phone"), not null
max_days_ahead :integer default(30), not null
min_notice_hours :integer default(4), not null
name :string not null
slug :string not null
created_at :datetime not null
updated_at :datetime not null
Indexes
index_scheduler_booking_pages_on_active (active)
index_scheduler_booking_pages_on_slug (slug) UNIQUE
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
#publish_event
Instance Attribute Details
#buffer_after_minutes ⇒ Object
41
|
# File 'app/models/scheduler_booking_page.rb', line 41
validates :buffer_before_minutes, :buffer_after_minutes, numericality: { greater_than_or_equal_to: 0 }
|
#buffer_before_minutes ⇒ Object
41
|
# File 'app/models/scheduler_booking_page.rb', line 41
validates :buffer_before_minutes, :buffer_after_minutes, numericality: { greater_than_or_equal_to: 0 }
|
#duration_minutes ⇒ Object
40
|
# File 'app/models/scheduler_booking_page.rb', line 40
validates :duration_minutes, presence: true, numericality: { greater_than: 0 }
|
#host_assignment_strategy ⇒ Object
45
|
# File 'app/models/scheduler_booking_page.rb', line 45
validates :host_assignment_strategy, presence: true, inclusion: { in: %w[single round_robin] }
|
#location_type ⇒ Object
44
|
# File 'app/models/scheduler_booking_page.rb', line 44
validates :location_type, presence: true, inclusion: { in: %w[phone zoom customer_choice] }
|
#max_days_ahead ⇒ Object
43
|
# File 'app/models/scheduler_booking_page.rb', line 43
validates :max_days_ahead, numericality: { greater_than: 0 }
|
#min_notice_hours ⇒ Object
42
|
# File 'app/models/scheduler_booking_page.rb', line 42
validates :min_notice_hours, numericality: { greater_than_or_equal_to: 0 }
|
#name ⇒ Object
39
|
# File 'app/models/scheduler_booking_page.rb', line 39
validates :name, presence: true, uniqueness: true
|
Class Method Details
A relation of SchedulerBookingPages that are active. Active Record Scope
47
|
# File 'app/models/scheduler_booking_page.rb', line 47
scope :active, -> { where(active: true) }
|
Instance Method Details
#active_hosts ⇒ Object
68
69
70
|
# File 'app/models/scheduler_booking_page.rb', line 68
def active_hosts
scheduler_hosts.joins(:employee).merge(Employee.active_employees).order(:priority)
end
|
#customer_choice? ⇒ Boolean
64
65
66
|
# File 'app/models/scheduler_booking_page.rb', line 64
def customer_choice?
location_type == 'customer_choice'
end
|
#employees ⇒ ActiveRecord::Relation<Employee>
35
|
# File 'app/models/scheduler_booking_page.rb', line 35
has_many :employees, through: :scheduler_hosts
|
#round_robin? ⇒ Boolean
60
61
62
|
# File 'app/models/scheduler_booking_page.rb', line 60
def round_robin?
host_assignment_strategy == 'round_robin'
end
|
#scheduler_booking_questions ⇒ ActiveRecord::Relation<SchedulerBookingQuestion>
37
|
# File 'app/models/scheduler_booking_page.rb', line 37
has_many :scheduler_booking_questions, -> { ordered }, dependent: :destroy
|
#scheduler_bookings ⇒ ActiveRecord::Relation<SchedulerBooking>
36
|
# File 'app/models/scheduler_booking_page.rb', line 36
has_many :scheduler_bookings, dependent: :destroy
|
#scheduler_hosts ⇒ ActiveRecord::Relation<SchedulerHost>
34
|
# File 'app/models/scheduler_booking_page.rb', line 34
has_many :scheduler_hosts, dependent: :destroy
|
#should_generate_new_friendly_id? ⇒ Boolean
52
53
54
|
# File 'app/models/scheduler_booking_page.rb', line 52
def should_generate_new_friendly_id?
slug.blank? || will_save_change_to_attribute?(:name)
end
|
#single_host? ⇒ Boolean
56
57
58
|
# File 'app/models/scheduler_booking_page.rb', line 56
def single_host?
host_assignment_strategy == 'single'
end
|