Class: FreeSlot

Inherits:
Slot
  • Object
show all
Defined in:
app/models/free_slot.rb

Overview

This represents a Slot that the service Provider creates to allow Customers to book.

A FreeSlot does not stop existing after a Booking is associated with it.

Schema Information

Table name: slots

id                 :integer          not null, primary key
capacity           :integer          default("1")
min_booking_length :integer          default("15")
created_at         :datetime         not null
updated_at         :datetime         not null
slot_group_id      :integer
color_id           :integer          not null
type               :string           not null
provider_id        :integer
booking_state_id   :integer
period_id          :integer          not null
affiliation_id     :integer
free_slot_id       :integer

Instance Method Summary (collapse)

Methods inherited from Slot

week

Constructor Details

- (FreeSlot) initialize

This sets the FreeSlot's Color.



40
41
42
43
# File 'app/models/free_slot.rb', line 40

def initialize(*)
  super
  self.color ||= Color.green
end

Instance Method Details

- (Boolean) full?

This indicates whether the FreeSlot's number of associated Bookings equals the slot's capacity.

Returns:

  • (Boolean)


47
48
49
# File 'app/models/free_slot.rb', line 47

def full?
  capacity <= bookings.size
end