VRFS-3036 syncing ui/json

This commit is contained in:
Jonathan Kolyer 2015-06-03 06:41:21 +00:00
parent 4f5a39db18
commit dde84587b9
4 changed files with 41 additions and 35 deletions

View File

@ -114,6 +114,7 @@ module JamRuby
toHireMeta = super(self.json_schema[TO_HIRE],
{ keys: HIRE_SORT_VALS, map: HIRE_SORT_ORDERS })
toHireMeta.merge!({
KEY_BAND_STATUS => { keys: BAND_STATUS_VALS, map: BAND_STATUS },
KEY_PERF_SAMPLES => { keys: PERF_SAMPLES_VALS, map: PERF_SAMPLES },
})
@@search_meta = {
@ -267,8 +268,8 @@ module JamRuby
private
def _count(musician, key)
if mm = @user_counters[musician.id]
def _count(band, key)
if mm = @user_counters[band.id]
return mm[key]
end if @user_counters
0
@ -276,20 +277,20 @@ module JamRuby
public
def follow_count(musician)
_count(musician, COUNT_FOLLOW)
def follow_count(band)
_count(band, COUNT_FOLLOW)
end
def record_count(musician)
_count(musician, COUNT_RECORD)
def record_count(band)
_count(band, COUNT_RECORD)
end
def session_count(musician)
_count(musician, COUNT_SESSION)
def session_count(band)
_count(band, COUNT_SESSION)
end
def is_follower?(musician)
if mm = @user_counters[musician.id]
def is_follower?(band)
if mm = @user_counters[band.id]
return mm.include?(RESULT_FOLLOW)
end if @user_counters
false

View File

@ -56,7 +56,7 @@ describe 'Band Search Model' do
it "has follower counts" do
Follow.create(user_id: searcher.id, followable: Band.first)
search.search_results_page
expect(search.user_counters[Band.first.id][BandSearch::COUNT_FOLLOW]).to eq(1)
expect(search.follow_count(Band.first)).to eq(1)
end
end

View File

@ -82,10 +82,6 @@ context.JK.BaseSearchFilter = class BaseSearchFilter
_populateSortOrder: () =>
this._populateSelectIdentifier('sort_order')
_populateSkill: () =>
elem = $ '#'+@searchType+'-search-filter-builder select[name=skill_level]'
this._populateSelectWithInt(@profileUtils.skillLevelMap, this.filterData().skill_level.toString(), elem)
_populateGigs: () =>
elem = $ '#'+@searchType+'-search-filter-builder select[name=concert_gigs]'
this._populateSelectWithInt(@profileUtils.gigMap, this.filterData().concert_gigs.toString(), elem)
@ -323,6 +319,10 @@ context.JK.MusicianSearchFilter = class MusicianSearchFilter extends BaseSearchF
_populateGenres: () =>
super()
_populateSkill: () =>
elem = $ '#'+@searchType+'-search-filter-builder select[name=skill_level]'
this._populateSelectWithInt(@profileUtils.skillLevelMap, this.filterData().skill_level.toString(), elem)
_populateInstruments: () =>
super()
@ -549,9 +549,9 @@ context.JK.BandSearchFilter = class BandSearchFilter extends BaseSearchFilter
_searchFilterArgsToJoin: () =>
args =
tour_option: this.filterData().tour_option
skill_level: this.filterData().skill_level
play_commit: this.filterData().play_commit
touring_option: this.filterData().touring_option
band_status: this.filterData().band_status
play_commitment: this.filterData().play_commitment
band_type: this.filterData().band_type
concert_gigs: this.filterData().concert_gigs
@ -566,9 +566,9 @@ context.JK.BandSearchFilter = class BandSearchFilter extends BaseSearchFilter
has_free_gigs = ''
args =
skill_level: this.filterData().skill_level
band_status: this.filterData().band_status
concert_gigs: this.filterData().concert_gigs
perform_samples: this.filterData().perform_samples
performance_samples: this.filterData().performance_samples
has_max_cost: has_max_cost
max_cost: this.filterData().max_cost
has_free_gigs: has_free_gigs
@ -577,12 +577,12 @@ context.JK.BandSearchFilter = class BandSearchFilter extends BaseSearchFilter
this._populateInstruments()
this._populateSkill()
this._populateGigs()
this._populateBandType()
this._populatePlayCommit()
this._populateTourOption()
this._populateBandStatus()
_populateSearchFilterToHire: () =>
this._populateSkill()
this._populateBandStatus()
this._populateGigs()
this._populatePerformSamples()
@ -614,8 +614,12 @@ context.JK.BandSearchFilter = class BandSearchFilter extends BaseSearchFilter
when 'to_join' then this._populateSearchFilterToJoin()
when 'to_hire' then this._populateSearchFilterToHire()
_populateBandType: () =>
this._populateSelectIdentifier('band_type')
_populateSkill: () =>
elem = $ '#'+@searchType+'-search-filter-builder select[name=band_type]'
this._populateSelectWithInt(@profileUtils.skillLevelMap, this.filterData().band_type.toString(), elem)
_populateBandStatus: () =>
this._populateSelectIdentifier('band_status')
_populatePlayCommit: () =>
this._populateSelectIdentifier('play_commitment')
@ -642,7 +646,8 @@ context.JK.BandSearchFilter = class BandSearchFilter extends BaseSearchFilter
super(response)
resetFilter: () =>
super()
if this.willSearch(true)
@restPost({ filter: 'reset', subtype: @searchSubType }).done(this.didSearch)
cancelFilter: () =>
super()

View File

@ -52,14 +52,14 @@ script#template-band-search-filter-to_join type="text/template"
.field.builder-selector
label Play Commitment:
select.easydropdown name="play_commit"
option selected="selected" value="{play_commit}" {play_commit}
select.easydropdown name="play_commitment"
option selected="selected" value="{play_commitment}" {play_commitment}
.col-right
.field.builder-selector
label Status:
select.easydropdown name="skill_level"
option selected="selected" value="{skill_level}" {skill_level}
select.easydropdown name="band_status"
option selected="selected" value="{band_status}" {band_status}
.field.builder-selector
label Concert Gigs Played:
@ -68,8 +68,8 @@ script#template-band-search-filter-to_join type="text/template"
.field.builder-selector
label Touring Option:
select.easydropdown name="tour_option"
option selected="selected" value="{tour_option}" {tour_option}
select.easydropdown name="touring_option"
option selected="selected" value="{touring_option}" {touring_option}
.clearall
.clearall
@ -99,8 +99,8 @@ script#template-band-search-filter-to_hire type="text/template"
.col-right
.field.builder-selector
label Status:
select.easydropdown name="skill_level"
option selected="selected" value="{skill_level}" {skill_level}
select.easydropdown name="band_status"
option selected="selected" value="{band_status}" {band_status}
.field.builder-selector
label Concert Gigs Played:
@ -109,8 +109,8 @@ script#template-band-search-filter-to_hire type="text/template"
.field.builder-selector
label Performance Sample Available:
select.easydropdown name="perform_samples"
option selected="selected" value="{perform_samples}" {perform_samples}
select.easydropdown name="performance_samples"
option selected="selected" value="{performance_samples}" {performance_samples}
.field.builder-selector
<input type="checkbox" id="has_max_cost" {has_max_cost} >Find bands to play a paid gig at a cost not to exceed