Add booth limit
This commit is contained in:
parent
703813248d
commit
e73218b5ca
10 changed files with 66 additions and 18 deletions
|
|
@ -25,6 +25,7 @@ class Booth < ActiveRecord::Base
|
|||
:submitter_relationship,
|
||||
presence: true
|
||||
|
||||
scope :accepted, -> { where(state: 'accepted') }
|
||||
scope :confirmed, -> { where(state: 'confirmed') }
|
||||
|
||||
mount_uploader :picture, PictureUploader, mount_on: :logo_link
|
||||
|
|
|
|||
|
|
@ -738,6 +738,15 @@ class Conference < ActiveRecord::Base
|
|||
(start_hour..(end_hour - 1)).cover?(current_hour) ? current_hour - start_hour : 0
|
||||
end
|
||||
|
||||
##
|
||||
#
|
||||
# ====Returns
|
||||
# * +True+ -> if accepted booths are equal to the booth limit
|
||||
# * +False+ -> Accepted booths have not reached the booth limit
|
||||
def maximum_accepted_booths?
|
||||
booth_limit > 0 && booths.accepted.count + booths.confirmed.count >= booth_limit
|
||||
end
|
||||
|
||||
##
|
||||
# Return the current conference object to be used in RevisionCount
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue