From de294d19bb819a1be1e2f13d23d8951808b06e27 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Tue, 18 Feb 2014 14:24:32 +0000 Subject: [PATCH] * VRFS-1135; music session history has creator, participants, and band info now. --- .../jam_ruby/models/music_session_history.rb | 3 --- ruby/lib/jam_ruby/models/recording.rb | 8 ------- web/app/assets/javascripts/sessionModel.js | 1 + web/app/views/api_feeds/show.rabl | 21 +++++++++++++++---- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/ruby/lib/jam_ruby/models/music_session_history.rb b/ruby/lib/jam_ruby/models/music_session_history.rb index 94c68b847..29be1f4e1 100644 --- a/ruby/lib/jam_ruby/models/music_session_history.rb +++ b/ruby/lib/jam_ruby/models/music_session_history.rb @@ -43,9 +43,6 @@ module JamRuby self.comments.size end - def like_count - self.likes.size - end def tracks tracks = [] diff --git a/ruby/lib/jam_ruby/models/recording.rb b/ruby/lib/jam_ruby/models/recording.rb index 8efd4e73f..19ddd357b 100644 --- a/ruby/lib/jam_ruby/models/recording.rb +++ b/ruby/lib/jam_ruby/models/recording.rb @@ -44,14 +44,6 @@ module JamRuby self.comments.size end - def like_count - self.likes.size - end - - def play_count - self.plays.size - end - def not_already_recording if music_session && music_session.is_recording? errors.add(:music_session, ValidationMessages::ALREADY_BEING_RECORDED) diff --git a/web/app/assets/javascripts/sessionModel.js b/web/app/assets/javascripts/sessionModel.js index 3f38d4b9e..419e8c920 100644 --- a/web/app/assets/javascripts/sessionModel.js +++ b/web/app/assets/javascripts/sessionModel.js @@ -263,6 +263,7 @@ $.each(joins, function(i,v) { if (v.client_id != clientId) { + client.ParticipantJoined(newSession, v); } }); diff --git a/web/app/views/api_feeds/show.rabl b/web/app/views/api_feeds/show.rabl index c6e8e523c..d3253d3d7 100644 --- a/web/app/views/api_feeds/show.rabl +++ b/web/app/views/api_feeds/show.rabl @@ -7,7 +7,20 @@ glue :music_session_history do 'music_session_history' end - attributes :id, :description, :genres, :created_at, :session_removed_at + attributes :id, :description, :genres, :created_at, :session_removed_at, :comment_count, :like_count, :play_count + + + child(:user => :creator) { + attributes :id, :first_name, :last_name, :photo_url + } + + child(:unique_users => :participants) { + attributes :id, :first_name, :last_name, :photo_url + } + + child(:band => :band) { + attributes :id, :name, :location, :photo_url + } child(:music_session => :music_session) do # only show mount info if fan_access is public. Eventually we'll also need to show this in other scenarios, like if invited @@ -28,12 +41,12 @@ glue :recording do attributes :id, :band, :created_at, :duration, :comment_count, :like_count, :play_count - child(:band => :band) { + child(:owner => :owner) { attributes :id, :name, :location, :photo_url } - child(:owner => :owner) { - attributes :id, :name, :location, :photo_url + child(:band => :band) { + attributes :id, :name, :location, :photo_url } child(:recorded_tracks => :recorded_tracks) {