Sort suggestions by speaker name
This commit is contained in:
parent
0efe4b95cb
commit
054ef9c947
|
@ -5,7 +5,7 @@ class SuggestionGroup
|
||||||
def self.where(conditions = {})
|
def self.where(conditions = {})
|
||||||
Event.joins(:track).includes(:user).where(conditions).group_by(&:user).map do |speaker, suggestions|
|
Event.joins(:track).includes(:user).where(conditions).group_by(&:user).map do |speaker, suggestions|
|
||||||
SuggestionGroup.new speaker: speaker, suggestions: suggestions
|
SuggestionGroup.new speaker: speaker, suggestions: suggestions
|
||||||
end
|
end.sort_by { |group| group.speaker.name }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.for_conference(conference, conditions = {})
|
def self.for_conference(conference, conditions = {})
|
||||||
|
|
|
@ -13,6 +13,10 @@ class User < ActiveRecord::Base
|
||||||
|
|
||||||
default_scope { order id: :desc }
|
default_scope { order id: :desc }
|
||||||
|
|
||||||
|
def name
|
||||||
|
speaker_profile.try(:name) || email
|
||||||
|
end
|
||||||
|
|
||||||
def toggle_admin!
|
def toggle_admin!
|
||||||
update admin: !admin
|
update admin: !admin
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue