VRFS-33 - save invitation receivers as part of session settings
This commit is contained in:
parent
990e4c1a0d
commit
5e87d00732
|
|
@ -312,13 +312,36 @@ module JamRuby
|
||||||
def self.save_session_settings(user, music_session)
|
def self.save_session_settings(user, music_session)
|
||||||
unless user.nil?
|
unless user.nil?
|
||||||
|
|
||||||
|
# only save genre id and description
|
||||||
|
genres = []
|
||||||
|
unless music_session.genres.nil?
|
||||||
|
music_session.genres.each do |genre|
|
||||||
|
g = Hash.new
|
||||||
|
g["id"] = genre.id
|
||||||
|
g["description"] = genre.description
|
||||||
|
genres << g
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# only save invitation receiver id and name
|
||||||
|
invitees = []
|
||||||
|
unless music_session.invitations.nil?
|
||||||
|
music_session.invitations.each do |invitation|
|
||||||
|
i = Hash.new
|
||||||
|
i["id"] = invitation.receiver.id
|
||||||
|
i["name"] = invitation.receiver.name
|
||||||
|
invitees << i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
session_settings = { :band_id => music_session.band_id,
|
session_settings = { :band_id => music_session.band_id,
|
||||||
:musician_access => music_session.musician_access,
|
:musician_access => music_session.musician_access,
|
||||||
:approval_required => music_session.approval_required,
|
:approval_required => music_session.approval_required,
|
||||||
:fan_chat => music_session.fan_chat,
|
:fan_chat => music_session.fan_chat,
|
||||||
:fan_access => music_session.fan_access,
|
:fan_access => music_session.fan_access,
|
||||||
:description => music_session.description,
|
:description => music_session.description,
|
||||||
:genres => music_session.genres
|
:genres => genres,
|
||||||
|
:invitees => invitees
|
||||||
}.to_json
|
}.to_json
|
||||||
|
|
||||||
user.session_settings = session_settings
|
user.session_settings = session_settings
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue