* VRFS-3042 - remove duplicate registrations on pagination

This commit is contained in:
Seth Call 2015-04-17 14:01:07 -05:00
parent 3a2590a472
commit 3c37cbbf59
20 changed files with 125 additions and 24 deletions

View File

@ -277,4 +277,5 @@ sales.sql
show_whats_next_count.sql
recurly_adjustments.sql
signup_hints.sql
packaging_notices.sql
packaging_notices.sql
first_played_jamtrack_at.sql

View File

@ -0,0 +1 @@
ALTER TABLE users ADD COLUMN first_played_jamtrack_at TIMESTAMP;

View File

@ -113,6 +113,7 @@ module JamRuby
result = {}
backing_tracks = [] unless backing_tracks
tracks = [] unless tracks
Track.transaction do
connection = Connection.find_by_client_id!(clientId)

View File

@ -204,7 +204,7 @@ module JamRuby
scope :email_opt_in, where(:subscribe_email => true)
def user_progression_fields
@user_progression_fields ||= Set.new ["first_downloaded_client_at", "first_ran_client_at", "first_music_session_at", "first_real_music_session_at", "first_good_music_session_at", "first_certified_gear_at", "first_invited_at", "first_friended_at", "first_recording_at", "first_social_promoted_at" ]
@user_progression_fields ||= Set.new ["first_downloaded_client_at", "first_ran_client_at", "first_music_session_at", "first_real_music_session_at", "first_good_music_session_at", "first_certified_gear_at", "first_invited_at", "first_friended_at", "first_recording_at", "first_social_promoted_at", "first_played_jamtrack_at" ]
end
def update_progression_field(field_name, time = DateTime.now)

View File

@ -207,7 +207,7 @@
var user = app.user()
if(user) {
user.done(function(userProfile) {
if (userProfile.show_whats_next && userProfile.show_whats_next_count < 10 &&
if (!userProfile.show_jamtrack_guide && userProfile.show_whats_next && userProfile.show_whats_next_count < 10 &&
window.location.pathname.indexOf(gon.client_path) == 0 &&
window.location.hash.indexOf('/checkout') == -1 &&
!app.layout.isDialogShowing('getting-started'))

View File

@ -26,4 +26,49 @@
}
}
function bigHelpOptions(options) {
return {positions: options.positions, offsetParent: options.offsetParent,
spikeGirth: 15,
spikeLength: 20,
fill: 'white',
cornerRadius:4,
strokeWidth: 2,
cssStyles: {
fontWeight:'bold',
fontSize: '20px',
backgroundColor:'transparent',
color:'#ed3618'}}
}
function jamTrackGuide(callback) {
if(gon.isNativeClient) {
context.JK.app.user().done(function(user) {
if(user.show_jamtrack_guide) {
setTimeout(function() {
callback()
}, 1000)
}
})
}
}
helpBubble.jamtrackGuideTile = function ($element, $offsetParent) {
jamTrackGuide(function() {
context.JK.prodBubble($element, 'jamtrack-guide-tile', {}, bigHelpOptions({positions:['top'], offsetParent: $offsetParent}))
})
}
helpBubble.jamtrackGuidePrivate = function ($element, $offsetParent) {
jamTrackGuide(function() {
context.JK.prodBubble($element, 'jamtrack-guide-private', {}, bigHelpOptions({positions:['right'], offsetParent: $offsetParent}))
})
}
helpBubble.jamtrackGuideSession = function ($element, $offsetParent) {
jamTrackGuide(function() {
context.JK.prodBubble($element, 'jamtrack-guide-session', {}, bigHelpOptions({positions:['left'], offsetParent: $offsetParent}))
})
}
})(window, jQuery);

View File

@ -11,6 +11,12 @@
function beforeShow(data) {
}
function afterShow(data) {
context.JK.HelpBubbleHelper.jamtrackGuideTile($('.homecard.createsession'), $screen);
}
function mouseenterTile() {
$(this).addClass('hover');
}
@ -84,7 +90,7 @@
}
this.initialize = function() {
var screenBindings = { 'beforeShow': beforeShow };
var screenBindings = { 'beforeShow': beforeShow, 'afterShow': afterShow };
app.bindScreen('home', screenBindings);
events();
$screen = $('.screen[layout-id="home"]')

View File

@ -117,7 +117,7 @@ context.JK.JamTrackScreen=class JamTrackScreen
# if we less results than asked for, end searching
@scroller.infinitescroll 'pause'
if @currentPage == 0 and response.jamtracks.length == 0
@content.append '<td colspan="3" class="no-jamtracks-msg">No JamTracks found.</td>'
@content.append '<td colspan="3" class="no-jamtracks-msg\'>No JamTracks found.</div>'
if @currentPage > 0
@noMoreJamtracks.show()
# there are bugs with infinitescroll not removing the 'loading'.
@ -164,12 +164,12 @@ context.JK.JamTrackScreen=class JamTrackScreen
e.preventDefault()
@app.layout.showDialog 'jamtrack-availability-dialog'
registerEvents:() =>
registerEvents:(parent) =>
#@screen.find('.jamtrack-detail-btn').on 'click', this.showJamtrackDescription
@screen.find('.play-button').on 'click', this.playJamtrack
@screen.find('.jamtrack-add-cart').on 'click', this.addToCartJamtrack
@screen.find('.license-us-why').on 'click', this.licenseUSWhy
@screen.find('.jamtrack-detail-btn').on 'click', this.toggleExpanded
parent.find('.play-button').on 'click', this.playJamtrack
parent.find('.jamtrack-add-cart').on 'click', this.addToCartJamtrack
parent.find('.license-us-why').on 'click', this.licenseUSWhy
parent.find('.jamtrack-detail-btn').on 'click', this.toggleExpanded
# @screen.find('.jamtrack-preview').each (index, element) =>
# new JK.JamTrackPreview(data.app, $element, jamTrack, track, {master_shows_duration: true})
@ -208,8 +208,8 @@ context.JK.JamTrackScreen=class JamTrackScreen
expanded: jamtrackExpanded
@jamtrackItem = $(context._.template($('#template-jamtrack').html(), options, variable: 'data'))
that.renderJamtrack(@jamtrackItem, jamtrack)
this.registerEvents()
that.registerEvents(@jamtrackItem)
renderJamtrack:(jamtrackElement, jamTrack) =>
@content.append jamtrackElement

View File

@ -344,6 +344,17 @@
return userData;
}
this.refreshUser = function() {
userDeferred = rest.getUserDetail();
if (userDeferred) {
userDeferred.done(this.updateUserCache)
}
else {
userDeferred = new $.Deferred();
userDeferred.reject('not_logged_in');
}
}
this.activeElementEvent = function(evtName, data) {
return this.layout.activeElementEvent(evtName, data);
}

View File

@ -32,8 +32,8 @@
//= require jamkazam
//= require utils
//= require ui_helper
//= require ga
//= require jam_rest
//= require ga
//= require web/signup_helper
//= require web/signin_helper
//= require web/signin

View File

@ -922,6 +922,13 @@
if(!context.JK.guardAgainstBrowser(app)) {
return false;
}
if(createSessionSettings.createType == '<%= MusicSession::CREATE_TYPE_QUICK_START %>') {
// short-cut added for private sessions; just get it going
beforeMoveStep1(); // this will populate the createSessionSettings structure
startSessionClicked(); // and this will create the session
return false;
}
}
if(optionRequiresMultiplayerProfile()) {
@ -986,7 +993,7 @@
}
function afterShow() {
context.JK.HelpBubbleHelper.jamtrackGuidePrivate($screen.find('li[create-type="quick-start"] label'), $screen)
}
function toggleDate(dontRebuildDropdowns) {

View File

@ -168,6 +168,8 @@
}
}
checkForCurrentUser();
context.JK.HelpBubbleHelper.jamtrackGuideSession($screen.find('li.open-a-jamtrack'), $screen)
}
function afterShow(data) {
@ -2720,6 +2722,9 @@
function playJamTrack(jamTrackId) {
var participantCnt=sessionModel.participants().length
rest.playJamTrack(jamTrackId)
.done(function() {
app.refreshUser();
})
context.stats.write('web.jamtrack.open', {
value: 1,
session_size: participantCnt,

View File

@ -215,6 +215,7 @@
// see if we already have tracks; if so, we need to run with these
var inputTracks = context.JK.TrackHelpers.getUserTracks(context.jamClient);
console.log("isNoInputProfile", gearUtils.isNoInputProfile())
if(inputTracks.length > 0 || gearUtils.isNoInputProfile() ) {
logger.debug("on page enter, tracks are already available")
sessionPageEnterDeferred.resolve(inputTracks);

View File

@ -52,13 +52,12 @@
}
gearUtils.isNoInputProfile = function(profile) {
if (profile === undefined) {
profile = context.jamClient.FTUEGetMusicProfileName();
profile = context.jamClient.LastUsedProfileName();
}
if(profile == SYSTEM_DEFAULT_PLAYBACK_ONLY) {
return true;
}
return profile == SYSTEM_DEFAULT_PLAYBACK_ONLY;
}
gearUtils.createProfileName = function (deviceInfo, chatName) {

View File

@ -3,7 +3,6 @@
body.jam, body.web, .dialog{
.bt-wrapper {
.bt-content {
color:#cccccc;
font-size:14px;
@ -49,6 +48,10 @@ body.jam, body.web, .dialog{
width:400px;
}
.big-help {
font-size:20px;
}
.help-hover-recorded-tracks, .help-hover-stream-mix, .help-hover-recorded-backing-tracks {
font-size:12px;

View File

@ -29,7 +29,12 @@ class ApiJamTracksController < ApiController
play = PlayablePlay.new
play.player_id = current_user.id
play.ip_address = request.remote_ip
unless current_user.first_played_jamtrack_at
User.where(id: current_user.id).update_all(first_played_jamtrack_at: Time.now)
current_user.first_played_jamtrack_at = Time.now
end
# VRFS-2916 jam_tracks.id is varchar: REMOVE
# play.jam_track = JamTrack.where(id: params[:id].to_i).first
# VRFS-2916 jam_tracks.id is varchar: ADD

View File

@ -21,6 +21,10 @@ if @user == current_user
Rails.application.config.one_free_jamtrack_per_user && user.has_redeemable_jamtrack
end
node :show_jamtrack_guide do |user|
!user.first_played_jamtrack_at && user.jam_track_rights.count > 0
end
node :mods do |user|
user.mods_json
end

View File

@ -250,3 +250,15 @@ script type="text/template" id="template-help-metromone-playback-modes"
p The metronome plays a local metronome back to each musician locally, with the local metronomes all synchronized to a global clock with high precision.
p The cluster test mixes playback of your local metronome with the streamed audio of all other musician metronomes. This will give you a good sense of the audible latency in your session. If all the metronome sounds are tightly clustered, there is low latency. If not, it will be more difficult to play in sync.
script type="text/template" id="template-help-jamtrack-guide-tile"
.jamtrack-guide-tile.big-help
p To try out your JamTrack, click the 'create session' tile.
script type="text/template" id="template-help-jamtrack-guide-private"
.jamtrack-guide-private.big-help
p To try out your JamTrack, select this option to create a session easily.
script type="text/template" id="template-help-jamtrack-guide-session"
.jamtrack-guide-open.big-help
p To try out your JamTrack, click here to open it.

View File

@ -94,7 +94,7 @@
a#open-a-recording[href="#"]
| Recording
- if Rails.application.config.jam_tracks_available || (current_user && current_user.admin)
li
li.open-a-jamtrack
a#open-a-jamtrack[href="#"]
| JamTrack
- if Rails.application.config.backing_tracks_available

View File

@ -460,10 +460,10 @@ def schedule_session(options = {})
find('.btn-next').trigger(:click)
end
unless quickstart || immediate
find('.btn-next', text: 'PUBLISH SESSION').trigger(:click)
else
if immediate
find('.btn-next', text: 'START SESSION').trigger(:click)
elsif !quickstart
find('.btn-next', text: 'PUBLISH SESSION').trigger(:click)
end
end