Merge branch 'develop' of bitbucket.org:jamkazam/jam-cloud into develop
This commit is contained in:
commit
977a83277d
|
|
@ -78,14 +78,22 @@ module JamRuby
|
|||
lng
|
||||
end
|
||||
|
||||
def recent_history
|
||||
def recent_history(session_id, claimed_recording_id)
|
||||
|
||||
recording_exclusion = "claimed_recordings.id != '#{claimed_recording_id}'" if claimed_recording_id
|
||||
recordings = Recording
|
||||
.joins(:claimed_recordings)
|
||||
.where(:band_id => self.id)
|
||||
.where('claimed_recordings.is_public=true')
|
||||
.where(recording_exclusion)
|
||||
.order('created_at DESC')
|
||||
.limit(10)
|
||||
|
||||
msh = MusicSession.where(:band_id => self.id)
|
||||
session_exclusion = "music_sessions.id != '#{session_id}'" if session_id
|
||||
msh = MusicSession
|
||||
.where(:band_id => self.id)
|
||||
.where(:fan_access => true)
|
||||
.where(session_exclusion)
|
||||
.order('created_at DESC')
|
||||
.limit(10)
|
||||
|
||||
|
|
|
|||
|
|
@ -304,6 +304,7 @@ module JamRuby
|
|||
filter_approved = only_approved ? 'AND rrrs.chosen = true' : ''
|
||||
|
||||
MusicSession.where(%Q{music_sessions.canceled = FALSE AND
|
||||
music_sessions.create_type != '#{CREATE_TYPE_QUICK_START}' AND
|
||||
(music_sessions.scheduled_start is NULL OR music_sessions.scheduled_start > NOW() - '4 hour'::INTERVAL) AND
|
||||
music_sessions.id in (
|
||||
select distinct(rs.music_session_id)
|
||||
|
|
|
|||
|
|
@ -439,14 +439,24 @@ module JamRuby
|
|||
mods_json[:connection_expire_time_client]
|
||||
end
|
||||
|
||||
def recent_history
|
||||
def recent_history(session_id, claimed_recording_id)
|
||||
# used to exclude currently viewed recording
|
||||
recording_exclusion = "claimed_recordings.id != '#{claimed_recording_id}'" if claimed_recording_id
|
||||
recordings = Recording
|
||||
.joins(:claimed_recordings)
|
||||
.where(:owner_id => self.id)
|
||||
.where("claimed_recordings.user_id = '#{self.id}'")
|
||||
.where('claimed_recordings.is_public=true')
|
||||
.where(recording_exclusion)
|
||||
.order('created_at DESC')
|
||||
.limit(10)
|
||||
|
||||
msh = MusicSession.where(:user_id => self.id)
|
||||
|
||||
# used to exclude currently viewed session
|
||||
session_exclusion = "music_sessions.id != '#{session_id}'" if session_id
|
||||
msh = MusicSession
|
||||
.where(:user_id => self.id)
|
||||
.where(:fan_access => true)
|
||||
.where(session_exclusion)
|
||||
.order('created_at DESC')
|
||||
.limit(10)
|
||||
|
||||
|
|
|
|||
|
|
@ -150,9 +150,13 @@ describe Band do
|
|||
Recording.where(:owner_id => user.id).size.should == 2
|
||||
Recording.where(:band_id => band.id).size.should == 2
|
||||
|
||||
history = band.recent_history
|
||||
history = band.recent_history(nil, nil)
|
||||
history.size.should == 1
|
||||
history.first.id.should == claimed_recording.recording.id
|
||||
|
||||
# exclude the claimed recording
|
||||
history = band.recent_history(nil, claimed_recording.id)
|
||||
history.size.should == 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -827,7 +827,7 @@ describe MusicSession do
|
|||
describe "scheduled_rsvp" do
|
||||
|
||||
let(:creator_1) { FactoryGirl.create(:user) }
|
||||
let!(:music_session_1) { FactoryGirl.create(:music_session, :creator => creator_1, description: "Bunny Jumps" ) }
|
||||
let!(:music_session_1) { FactoryGirl.create(:music_session, :creator => creator_1, description: "Bunny Jumps", :create_type => MusicSession::CREATE_TYPE_IMMEDIATE ) }
|
||||
|
||||
it "lists one" do
|
||||
MusicSession.scheduled_rsvp(creator_1).should == [music_session_1]
|
||||
|
|
|
|||
|
|
@ -560,9 +560,22 @@ describe User do
|
|||
|
||||
Recording.where(:owner_id => user.id).size.should == 2
|
||||
|
||||
history = user.recent_history
|
||||
history = user.recent_history(nil, nil)
|
||||
history.size.should == 1
|
||||
history.first.id.should == claimed_recording.recording.id
|
||||
|
||||
# exclude the claimed recording
|
||||
history = user.recent_history(nil, claimed_recording.id)
|
||||
history.size.should == 0
|
||||
end
|
||||
|
||||
it "should not retrieve excluded session" do
|
||||
music_session = FactoryGirl.create(:music_session)
|
||||
history = music_session.creator.recent_history(nil, nil)
|
||||
history.size.should == 1
|
||||
|
||||
history = music_session.creator.recent_history(music_session.id, nil)
|
||||
history.size.should == 0
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,12 @@
|
|||
} , { variable: 'data' }));
|
||||
|
||||
$('#account-content-scroller').html($template);
|
||||
|
||||
if(userDetail.upcoming_session_count > 0) {
|
||||
$('#account-scheduled-sessions-link').show();
|
||||
} else {
|
||||
$('#account-scheduled-sessions-link').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function prettyPrintAudioProfiles(profileMap) {
|
||||
|
|
|
|||
|
|
@ -109,9 +109,9 @@
|
|||
<% else %>
|
||||
<% if signed_in? && @music_session.fan_access %>
|
||||
<% unless @music_session.band.nil? %>
|
||||
<%= render :partial => "shared/landing_sidebar", :locals => {:user => @music_session.band, :recent_history => @music_session.band.recent_history} %>
|
||||
<%= render :partial => "shared/landing_sidebar", :locals => {:user => @music_session.band, :recent_history => @music_session.band.recent_history(@music_session.id, nil)} %>
|
||||
<% else %>
|
||||
<%= render :partial => "shared/landing_sidebar", :locals => {:user => @music_session.creator, :recent_history => @music_session.creator.recent_history} %>
|
||||
<%= render :partial => "shared/landing_sidebar", :locals => {:user => @music_session.creator, :recent_history => @music_session.creator.recent_history(@music_session.id, nil)} %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render :partial => "shared/cta_sidebar" %>
|
||||
|
|
|
|||
|
|
@ -100,9 +100,9 @@
|
|||
<% if !@claimed_recording.recording.deleted && (@claimed_recording.is_public || @claimed_recording.recording.has_access?(current_user)) %>
|
||||
<% if signed_in? %>
|
||||
<% unless @claimed_recording.recording.band.nil? %>
|
||||
<%= render :partial => "shared/landing_sidebar", :locals => {:user => @claimed_recording.recording.band, :recent_history => @claimed_recording.recording.band.recent_history} %>
|
||||
<%= render :partial => "shared/landing_sidebar", :locals => {:user => @claimed_recording.recording.band, :recent_history => @claimed_recording.recording.band.recent_history(nil, @claimed_recording.id)} %>
|
||||
<% else %>
|
||||
<%= render :partial => "shared/landing_sidebar", :locals => {:user => @claimed_recording.recording.owner, :recent_history => @claimed_recording.recording.owner.recent_history} %>
|
||||
<%= render :partial => "shared/landing_sidebar", :locals => {:user => @claimed_recording.recording.owner, :recent_history => @claimed_recording.recording.owner.recent_history(nil, @claimed_recording.id)} %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render :partial => "shared/cta_sidebar" %>
|
||||
|
|
|
|||
Loading…
Reference in New Issue