# Return all slots for a company
for_company(company)
# Return slot for a job_offer
for_job_offer(job_offer)
# 2 pack types
# - JobSlotPack
# - InternshipSlotPack
# 2 states
# - active
# - expired
# available_capacity is computed by diffing
# slot max capacity minus already active job_offers on this slot
def available_capacity
capacity - slot_ids.size
end
payment_types
It's a bitwise value
- :credits = 1
- :slots = 2
- :credits_permanent = 4
payment_types = [:credits, :slots] == 3
payment_types
Mixin
# return proper payment_types balance depending on attributes :
# - payable
# - resource
balance()
# return proper payment_type balance depending on params :
# - payable
# - resource
balance_for(resource_type, *payment_types)
credits_balance_for(resource_type)
slots_balance_for(resource_type)
############# Example
balance(:job, [:slots, :credits])
# (return Mash)
# => { total: 2, credits: 1, slots: 2, selected_payment: :slots }
balance(:job, [:credits])
# (return Mash)
# => { credits: 1, selected_payment: :credits }