Class: FreeSlot

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

Overview

This represents a free slot.

The kind of Slot that the service Provider creates in order to Customers to book.

A FreeSlot does not stop existing after a Booking is associated with it in the same way a drawer does not stop being a drawer once we fill it with stuff.

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

#respects_min_booking_length

Constructor Details

- (FreeSlot) initialize

Returns a new instance of FreeSlot



42
43
44
45
# File 'app/models/free_slot.rb', line 42

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

Instance Method Details

- (Boolean) full?

Returns:

  • (Boolean)


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

def full?
  capacity <= bookings.size
end