Merge branch 'master' into ticket-turnover-bug
This commit is contained in:
commit
cf4271a5d2
58 changed files with 155 additions and 43 deletions
|
|
@ -595,11 +595,11 @@ class Conference < ApplicationRecord
|
|||
# * +ActiveRecord+
|
||||
def self.get_active_conferences_for_dashboard
|
||||
result = Conference.where('start_date > ?', Time.now)
|
||||
.select('id, short_title, color, start_date')
|
||||
.select('id, short_title, color, start_date, organization_id')
|
||||
|
||||
if result.empty?
|
||||
result = Conference
|
||||
.select('id, short_title, color, start_date').limit(2)
|
||||
.select('id, short_title, color, start_date, organization_id').limit(2)
|
||||
.order(start_date: :desc)
|
||||
end
|
||||
result
|
||||
|
|
@ -611,7 +611,7 @@ class Conference < ApplicationRecord
|
|||
# ====Returns
|
||||
# * +ActiveRecord+
|
||||
def self.get_conferences_without_active_for_dashboard(active_conferences)
|
||||
result = Conference.select('id, short_title, color, start_date').order(start_date: :desc)
|
||||
result = Conference.select('id, short_title, color, start_date, organization_id').order(start_date: :desc)
|
||||
result - active_conferences
|
||||
end
|
||||
|
||||
|
|
@ -719,7 +719,7 @@ class Conference < ApplicationRecord
|
|||
# * +True+ -> If the registration limit has been reached or exceeded
|
||||
# * +False+ -> If the registration limit hasn't been exceeded
|
||||
def registration_limit_exceeded?
|
||||
registration_limit > 0 && registrations.count + program.speakers.confirmed.count - program.speakers.confirmed.registered(program.conference).count >= registration_limit
|
||||
registration_limit > 0 && registrations.count + program.speakers.confirmed.unregistered(program.conference).count >= registration_limit
|
||||
end
|
||||
|
||||
# Returns an hexadecimal color given a collection. The returned color changed
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ class Contact < ApplicationRecord
|
|||
|
||||
validates :conference, presence: true
|
||||
# Conferences only have one contact
|
||||
validates :facebook, :twitter, :googleplus, :instagram,
|
||||
validates :facebook, :twitter, :googleplus, :instagram, :mastodon,
|
||||
format: URI::regexp(%w(http https)), allow_blank: true
|
||||
|
||||
def has_social_media?
|
||||
return true if facebook.present? || twitter.present? || googleplus.present? || instagram.present? || email.present?
|
||||
return true if facebook.present? || twitter.present? || googleplus.present? || instagram.present? || mastodon.present? || email.present?
|
||||
false
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ class Program < ApplicationRecord
|
|||
def registered(conference)
|
||||
joins(:registrations).where('registrations.conference_id = ?', conference.id)
|
||||
end
|
||||
|
||||
def unregistered(conference)
|
||||
self - registered(conference)
|
||||
end
|
||||
end
|
||||
|
||||
accepts_nested_attributes_for :event_types, allow_destroy: true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue