VRFS-2874 : Some prerequisite functionality required for analytics.
This commit is contained in:
parent
ae050590f6
commit
4db40f6d3b
|
|
@ -7,7 +7,7 @@ module JamRuby
|
|||
|
||||
self.table_name = 'active_music_sessions'
|
||||
|
||||
attr_accessor :legal_terms, :max_score, :opening_jam_track, :opening_recording, :opening_backing_track, :opening_metronome
|
||||
attr_accessor :legal_terms, :max_score, :opening_jam_track, :opening_recording, :opening_backing_track, :opening_metronome, :jam_track_id
|
||||
|
||||
belongs_to :claimed_recording, :class_name => "JamRuby::ClaimedRecording", :foreign_key => "claimed_recording_id", :inverse_of => :playing_sessions
|
||||
belongs_to :claimed_recording_initiator, :class_name => "JamRuby::User", :inverse_of => :playing_claimed_recordings, :foreign_key => "claimed_recording_initiator_id"
|
||||
|
|
|
|||
|
|
@ -161,6 +161,9 @@ module JamRuby
|
|||
query = query.where("original_artist=?", options[:artist])
|
||||
end
|
||||
|
||||
if options[:id].present?
|
||||
query = query.where("jam_tracks.id=?", options[:id])
|
||||
end
|
||||
|
||||
if options[:group_artist]
|
||||
query = query.select("original_artist, array_agg(jam_tracks.id) AS id, MIN(name) AS name, MIN(description) AS description, MIN(recording_type) AS recording_type, MIN(original_artist) AS original_artist, MIN(songwriter) AS songwriter, MIN(publisher) AS publisher, MIN(sales_region) AS sales_region, MIN(price) AS price, MIN(version) AS version, MIN(genre_id) AS genre_id")
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ module JamRuby
|
|||
belongs_to :owner, :class_name => "JamRuby::User", :inverse_of => :owned_recordings, :foreign_key => 'owner_id'
|
||||
belongs_to :band, :class_name => "JamRuby::Band", :inverse_of => :recordings
|
||||
belongs_to :music_session, :class_name => "JamRuby::ActiveMusicSession", :inverse_of => :recordings, foreign_key: :music_session_id
|
||||
belongs_to :non_active_music_session, :class_name => "JamRuby::MusicSession", foreign_key: :music_session_id
|
||||
belongs_to :jam_track, :class_name => "JamRuby::JamTrack", :inverse_of => :recordings, :foreign_key => 'jam_track_id'
|
||||
belongs_to :jam_track_initiator, :class_name => "JamRuby::User", :inverse_of => :initiated_jam_track_recordings, :foreign_key => 'jam_track_initiator_id'
|
||||
|
||||
|
|
@ -196,7 +197,7 @@ module JamRuby
|
|||
|
||||
|
||||
def has_access?(user)
|
||||
users.exists?(user)
|
||||
users.exists?(user) || plays.where("player_id=?", user).count != 0
|
||||
end
|
||||
|
||||
# Start recording a session.
|
||||
|
|
|
|||
|
|
@ -287,11 +287,6 @@
|
|||
}
|
||||
|
||||
function addPlayablePlay(playableId, playableType, claimedRecordingId, userId) {
|
||||
if (playableType == 'JamRuby::Recording') {
|
||||
context.JK.GA.trackRecordingPlay();
|
||||
} else if (playableType == 'JamRuby::MusicSession') {
|
||||
context.JK.GA.trackSessionPlay();
|
||||
}
|
||||
return $.ajax({
|
||||
url: '/api/users/' + playableId + "/plays",
|
||||
type: "POST",
|
||||
|
|
@ -1452,7 +1447,8 @@
|
|||
});
|
||||
}
|
||||
|
||||
function getJamtracks(options) {
|
||||
function getJamTracks(options) {
|
||||
logger.debug("GETTING JAMTRACKS")
|
||||
return $.ajax({
|
||||
type: "GET",
|
||||
url: '/api/jamtracks?' + $.param(options),
|
||||
|
|
@ -1771,7 +1767,7 @@
|
|||
this.updateAudioLatency = updateAudioLatency;
|
||||
this.getJamTrack = getJamTrack;
|
||||
this.getJamTrackWithArtistInfo = getJamTrackWithArtistInfo;
|
||||
this.getJamtracks = getJamtracks;
|
||||
this.getJamTracks = getJamTracks;
|
||||
this.getPurchasedJamTracks = getPurchasedJamTracks;
|
||||
this.getPaymentHistory = getPaymentHistory;
|
||||
this.getSalesHistory = getSalesHistory;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ context.JK.JamTrackScreen=class JamTrackScreen
|
|||
refresh:() =>
|
||||
@currentQuery = this.buildQuery()
|
||||
that = this
|
||||
rest.getJamtracks(@currentQuery).done((response) =>
|
||||
rest.getJamTracks(@currentQuery).done((response) =>
|
||||
that.clearResults()
|
||||
that.handleJamtrackResponse(response)
|
||||
).fail (jqXHR) =>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ context.JK.JamTrackLanding = class JamTrackLanding
|
|||
|
||||
beforeShow:() =>
|
||||
# Get artist names and build links
|
||||
@rest.getJamtracks({group_artist: true})
|
||||
@rest.getJamTracks({group_artist: true})
|
||||
.done(this.buildArtistLinks)
|
||||
.fail(this.handleFailure)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ if !current_user
|
|||
}
|
||||
else
|
||||
|
||||
attributes :id, :name, :description, :musician_access, :approval_required, :fan_access, :fan_chat, :band_id, :user_id, :claimed_recording_initiator_id, :track_changes_counter, :max_score, :backing_track_path, :metronome_active, :jam_track_initiator_id
|
||||
attributes :id, :name, :description, :musician_access, :approval_required, :fan_access, :fan_chat, :band_id, :user_id, :claimed_recording_initiator_id, :track_changes_counter, :max_score, :backing_track_path, :metronome_active, :jam_track_initiator_id, :jam_track_id
|
||||
|
||||
node :can_join do |session|
|
||||
session.can_join?(current_user, true)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
object @recording
|
||||
|
||||
attributes :id, :band, :created_at, :duration, :comment_count, :like_count, :play_count, :when_will_be_discarded?, :jam_track_id, :jam_track_initiator_id
|
||||
attributes :id, :band, :created_at, :duration, :comment_count, :like_count, :play_count, :when_will_be_discarded?, :jam_track_id, :jam_track_initiator_id, :music_session_id, :music_session
|
||||
|
||||
node :fan_access do |recording|
|
||||
recording.non_active_music_session.fan_access
|
||||
end
|
||||
|
||||
node :mix do |recording|
|
||||
if recording.mix
|
||||
|
|
|
|||
Loading…
Reference in New Issue