From 3c37cbbf59faeb363c3413e673c8895c63a87a4c Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 17 Apr 2015 14:01:07 -0500 Subject: [PATCH] * VRFS-3042 - remove duplicate registrations on pagination --- db/manifest | 3 +- db/up/first_played_jamtrack_at.sql | 1 + ruby/lib/jam_ruby/models/track.rb | 1 + ruby/lib/jam_ruby/models/user.rb | 2 +- .../javascripts/everywhere/everywhere.js | 2 +- .../assets/javascripts/helpBubbleHelper.js | 45 +++++++++++++++++++ web/app/assets/javascripts/homeScreen.js | 8 +++- .../javascripts/jam_track_screen.js.coffee | 16 +++---- web/app/assets/javascripts/jamkazam.js | 11 +++++ web/app/assets/javascripts/landing/landing.js | 2 +- .../javascripts/scheduled_session.js.erb | 9 +++- web/app/assets/javascripts/session.js | 5 +++ web/app/assets/javascripts/sessionModel.js | 1 + .../assets/javascripts/wizard/gear_utils.js | 7 ++- .../assets/stylesheets/client/help.css.scss | 5 ++- .../controllers/api_jam_tracks_controller.rb | 7 ++- web/app/views/api_users/show.rabl | 4 ++ web/app/views/clients/_help.html.slim | 12 +++++ web/app/views/clients/_session.html.slim | 2 +- web/spec/support/utilities.rb | 6 +-- 20 files changed, 125 insertions(+), 24 deletions(-) create mode 100644 db/up/first_played_jamtrack_at.sql diff --git a/db/manifest b/db/manifest index 7f3451da3..5c93932dc 100755 --- a/db/manifest +++ b/db/manifest @@ -277,4 +277,5 @@ sales.sql show_whats_next_count.sql recurly_adjustments.sql signup_hints.sql -packaging_notices.sql \ No newline at end of file +packaging_notices.sql +first_played_jamtrack_at.sql \ No newline at end of file diff --git a/db/up/first_played_jamtrack_at.sql b/db/up/first_played_jamtrack_at.sql new file mode 100644 index 000000000..aeddf7757 --- /dev/null +++ b/db/up/first_played_jamtrack_at.sql @@ -0,0 +1 @@ +ALTER TABLE users ADD COLUMN first_played_jamtrack_at TIMESTAMP; \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/track.rb b/ruby/lib/jam_ruby/models/track.rb index e430edb2d..1a8db2047 100644 --- a/ruby/lib/jam_ruby/models/track.rb +++ b/ruby/lib/jam_ruby/models/track.rb @@ -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) diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index be020d4b3..084be7323 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -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) diff --git a/web/app/assets/javascripts/everywhere/everywhere.js b/web/app/assets/javascripts/everywhere/everywhere.js index c5e6e742a..741f70b3b 100644 --- a/web/app/assets/javascripts/everywhere/everywhere.js +++ b/web/app/assets/javascripts/everywhere/everywhere.js @@ -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')) diff --git a/web/app/assets/javascripts/helpBubbleHelper.js b/web/app/assets/javascripts/helpBubbleHelper.js index 9c9a05bd5..a43800e0e 100644 --- a/web/app/assets/javascripts/helpBubbleHelper.js +++ b/web/app/assets/javascripts/helpBubbleHelper.js @@ -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); \ No newline at end of file diff --git a/web/app/assets/javascripts/homeScreen.js b/web/app/assets/javascripts/homeScreen.js index ec7b86d50..aeb191fb4 100644 --- a/web/app/assets/javascripts/homeScreen.js +++ b/web/app/assets/javascripts/homeScreen.js @@ -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"]') diff --git a/web/app/assets/javascripts/jam_track_screen.js.coffee b/web/app/assets/javascripts/jam_track_screen.js.coffee index 9ab9bf2fb..4009743fb 100644 --- a/web/app/assets/javascripts/jam_track_screen.js.coffee +++ b/web/app/assets/javascripts/jam_track_screen.js.coffee @@ -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 'No JamTracks found.' + @content.append ' 0 || gearUtils.isNoInputProfile() ) { logger.debug("on page enter, tracks are already available") sessionPageEnterDeferred.resolve(inputTracks); diff --git a/web/app/assets/javascripts/wizard/gear_utils.js b/web/app/assets/javascripts/wizard/gear_utils.js index 051ca1949..f7b891749 100644 --- a/web/app/assets/javascripts/wizard/gear_utils.js +++ b/web/app/assets/javascripts/wizard/gear_utils.js @@ -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) { diff --git a/web/app/assets/stylesheets/client/help.css.scss b/web/app/assets/stylesheets/client/help.css.scss index 6dbfa7149..b5c3cf17b 100644 --- a/web/app/assets/stylesheets/client/help.css.scss +++ b/web/app/assets/stylesheets/client/help.css.scss @@ -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; diff --git a/web/app/controllers/api_jam_tracks_controller.rb b/web/app/controllers/api_jam_tracks_controller.rb index fd8019462..2f7a9c859 100644 --- a/web/app/controllers/api_jam_tracks_controller.rb +++ b/web/app/controllers/api_jam_tracks_controller.rb @@ -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 diff --git a/web/app/views/api_users/show.rabl b/web/app/views/api_users/show.rabl index 574ce7471..c86a6e71c 100644 --- a/web/app/views/api_users/show.rabl +++ b/web/app/views/api_users/show.rabl @@ -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 diff --git a/web/app/views/clients/_help.html.slim b/web/app/views/clients/_help.html.slim index 235c23381..f0eeaca3e 100644 --- a/web/app/views/clients/_help.html.slim +++ b/web/app/views/clients/_help.html.slim @@ -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. \ No newline at end of file diff --git a/web/app/views/clients/_session.html.slim b/web/app/views/clients/_session.html.slim index 3ffaa3b68..173640e97 100644 --- a/web/app/views/clients/_session.html.slim +++ b/web/app/views/clients/_session.html.slim @@ -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 diff --git a/web/spec/support/utilities.rb b/web/spec/support/utilities.rb index 8248cfbae..da8ab523e 100644 --- a/web/spec/support/utilities.rb +++ b/web/spec/support/utilities.rb @@ -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