* VRFS-3488 - jamtrack search by artist and song need to pin to the match, not do a sloppy search

This commit is contained in:
Seth Call 2015-08-26 20:26:39 -05:00
parent a4bd28e168
commit 22ea6e89fd
12 changed files with 50 additions and 19 deletions

View File

@ -225,6 +225,7 @@ FactoryGirl.define do
factory :jam_track, :class => JamRuby::JamTrack do
sequence(:name) { |n| "jam-track-#{n}" }
sequence(:description) { |n| "description-#{n}" }
sequence(:slug) { |n| "slug-#{n}" }
time_signature '4/4'
status 'Production'
recording_type 'Cover'

View File

@ -305,6 +305,10 @@ module JamRuby
query = query.where("original_artist=?", options[:artist])
end
if options[:song].present?
query = query.where("name=?", options[:song])
end
if options[:id].present?
query = query.where("jam_tracks.id=?", options[:id])
end

View File

@ -726,6 +726,7 @@ FactoryGirl.define do
factory :jam_track, :class => JamRuby::JamTrack do
sequence(:name) { |n| "jam-track-#{n}" }
sequence(:description) { |n| "description-#{n}" }
sequence(:slug) { |n| "slug-#{n}" }
time_signature '4/4'
status 'Production'
recording_type 'Cover'

View File

@ -12,7 +12,8 @@
};
app.bindScreen('account/video', screenBindings);
$webcamViewer.init($("#account-video-profile .webcam-container"), true)
var $root = $("#account-video-profile .webcam-container")
$webcamViewer.init($root, true)
}
function beforeShow() {

View File

@ -289,8 +289,16 @@ MIX_MODES = context.JK.MIX_MODES
$root.find('.content-body-scroller').off('scroll')
$root.find('.end-of-jamtrack-list').hide()
artistSearch = {limit:100}
if search_type == 'artist-select'
# the user wants to see just artists matching thes exact name
artistSearch.artist = input
else
# the user wants to see anything sort of matching input
artistSearch.artist_search = input
if input?
@rest.getJamTrackArtists({artist_search: input, limit:100})
@rest.getJamTrackArtists(artistSearch)
.done((response) =>
@setState({artists:response.artists})
@ -300,9 +308,10 @@ MIX_MODES = context.JK.MIX_MODES
@logger.debug("Search type", search_type)
if search_type == 'artist-select'
query.artist_search = input # works with ilike
query.artist = input # works like exact match
else if search_type == 'song-select'
query.song_search = input # works with ilike
query.song = input # works as exact match
else
query.search = input # works with tsv
@rest.getJamTracks(query)

View File

@ -53,7 +53,8 @@ NotificationActions = @NotificationActions
if gon.global.video_available && gon.global.video_available!="none" && context.JK.WebcamViewer?
@webcamViewer = new context.JK.WebcamViewer()
@webcamViewer.init($("#create-session-layout"))
$sessionLayout = $("#create-session-layout")
cwebcamViewer.init($sessionLayout, false)
@webcamViewer.setVideoOff()
issueChange: () ->

View File

@ -3294,8 +3294,8 @@
$voiceChat = $screen.find('#voice-chat');
$tracksHolder = $screen.find('#tracks')
if(gon.global.video_available && gon.global.video_available!="none") {
webcamViewer.init($("#create-session-layout .webcam-container"))
webcamViewer.setVideoOff()
//webcamViewer.init($("#create-session-layout .webcam-container"), false)
//webcamViewer.setVideoOff()
}
events();

View File

@ -50,12 +50,7 @@ context.JK.WebcamViewer = class WebcamViewer
@rescanTimeout = null
@lastDeviceList = null
init: (root, showBackBtn) =>
# the session usage of webcamViewer does not actually pass in anything
root = $() unless root?
@root = root
@showBackBtn = showBackBtn
init: (@root, @showBackButton) =>
@toggleBtn = @root.find(".webcam-test-btn")
@webcamSelect = @root.find(".webcam-select-container select")
@resolutionSelect = @root.find(".webcam-resolution-select-container select")
@ -70,8 +65,7 @@ context.JK.WebcamViewer = class WebcamViewer
#logger.debug("Initialed with (unique) select",@webcamSelect)
console.log("@videoSettingsHelp", @videoSettingsHelp)
context.JK.helpBubble(@videoSettingsHelp, 'ftue-video-settings', {}, {width:300})
context.JK.helpBubble(@videoSettingsHelp, 'ftue-video-settings', {}, {width:300}) if @videoSettingsHelp.length > 0
@videoSettingsHelp.click(false)
beforeShow:() =>

View File

@ -8,7 +8,7 @@
var $webcamViewer = new context.JK.WebcamViewer()
function initialize(_$step) {
$step = _$step
$webcamViewer.init($step)
$webcamViewer.init($step, false)
}
function beforeShow() {

View File

@ -322,7 +322,7 @@
display:none;
margin-top: 20px;
margin-left: -5px;
span.spinner-small {
display:inline-block;
vertical-align: middle;

View File

@ -714,6 +714,7 @@ FactoryGirl.define do
factory :jam_track, :class => JamRuby::JamTrack do
sequence(:name) { |n| "jam-track-#{n}" }
sequence(:description) { |n| "description-#{n}" }
sequence(:slug) { |n| "slug-#{n}" }
time_signature '4/4'
status 'Production'
recording_type 'Cover'

View File

@ -5,8 +5,8 @@ describe "JamTrack Search", :js => true, :type => :feature, :capybara_feature =>
let(:user) { FactoryGirl.create(:user, has_redeemable_jamtrack: true) }
let(:jt_us) { FactoryGirl.create(:jam_track, :name=>'jt_us', sales_region: 'United States', make_track: true, original_artist: "foobar") }
let(:jt_ww) { FactoryGirl.create(:jam_track, :name=>'jt_ww', sales_region: 'Worldwide', make_track: true, original_artist: "barfoo") }
let(:jt_rock) { FactoryGirl.create(:jam_track, :name=>'jt_rock', genres: [JamRuby::Genre.find('rock')], make_track: true, original_artist: "badfood") }
let(:jt_blues) { FactoryGirl.create(:jam_track, :name=>'jt_blues', genres: [JamRuby::Genre.find('blues')], make_track: true, original_artist: "foodbart") }
let(:jt_rock) { FactoryGirl.create(:jam_track, :name=>'the live', genres: [JamRuby::Genre.find('rock')], make_track: true, original_artist: "the food") }
let(:jt_blues) { FactoryGirl.create(:jam_track, :name=>'live dog', genres: [JamRuby::Genre.find('blues')], make_track: true, original_artist: "food dog") }
before(:all) do
Capybara.javascript_driver = :poltergeist
@ -25,6 +25,25 @@ describe "JamTrack Search", :js => true, :type => :feature, :capybara_feature =>
end
it "searches for exact artist name" do
jt_rock.touch
jt_blues.touch
fast_signin user, "/client?artist=the food#/jamtrack/search"
find('h1', text: 'search jamtracks')
find('.jamtrack-record[data-jamtrack-id="' + jt_rock.id + '"]')
page.assert_selector('.jamtrack-record', count: 1)
end
it "searches for exact song name" do
jt_rock.touch
jt_blues.touch
fast_signin user, "/client?song=live dog#/jamtrack/search"
find('h1', text: 'search jamtracks')
find('.jamtrack-record[data-jamtrack-id="' + jt_blues.id + '"]')
page.assert_selector('.jamtrack-record', count: 1)
end
it "search repeatedly" do
fast_signin user, "/client#/jamtrack/search"