Merge branch 'develop' of bitbucket.org:jamkazam/jam-cloud into develop

This commit is contained in:
Brian Smith 2014-02-18 02:25:06 -05:00
commit c196ad8711
6 changed files with 11 additions and 24 deletions

View File

@ -76,7 +76,7 @@ module JamRuby
PARAM_BAND = :srch_b
PARAM_FEED = :srch_f
F_PER_PAGE = B_PER_PAGE = M_PER_PAGE = 10
F_PER_PAGE = B_PER_PAGE = M_PER_PAGE = 20
M_MILES_DEFAULT = 500
B_MILES_DEFAULT = 0

View File

@ -1091,8 +1091,8 @@ module JamRuby
end
def top_followings
@topf ||= User.joins("INNER JOIN follows ON follows.followable_id = users.id")
.where(['follows.user_id = ?',self.id])
@topf ||= User.joins("INNER JOIN follows ON follows.followable_id = users.id AND follows.followable_type = '#{self.class.to_s}'")
.where(['follows.user_id = ?', self.id])
.order('follows.created_at DESC')
.limit(3)
end

View File

@ -200,7 +200,7 @@
$('#band_genre').change(refreshDisplay);
$('#band_order_by').change(refreshDisplay);
$('#band-filter-results').bind('scroll', function() {
$('#band-filter-results').closest('.content-body-scroller').bind('scroll', function() {
if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) {
if (page_num < page_count) {
page_num += 1;

View File

@ -222,7 +222,7 @@
$('#musician_instrument').change(refreshDisplay);
$('#musician_order_by').change(refreshDisplay);
$('#musician-filter-results').bind('scroll', function() {
$('#musician-filter-results').closest('.content-body-scroller').bind('scroll', function() {
if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) {
if (page_num < page_count) {
page_num += 1;

View File

@ -26,9 +26,11 @@
musicianHtml += '<td width="75"><a href="#">' + val.name + '</a></td>';
instrumentHtml = '<td><div class="nowrap">';
$.each(val.instruments, function(index, instrument) {
instrumentHtml += '<img src="' + instrumentLogoMap[instrument.instrument_id] + '" width="24" height="24" />&nbsp;';
});
if (val.instruments) { // @FIXME: edge case for Test user that has no instruments?
$.each(val.instruments, function(index, instrument) {
instrumentHtml += '<img src="' + instrumentLogoMap[instrument.instrument_id] + '" width="24" height="24" />&nbsp;';
});
}
instrumentHtml += '</div></td>';

View File

@ -82,33 +82,18 @@ describe "Musician Search API", :type => :api do
f3.followable = @user4
f3.save
# @user3
f4 = Follow.new
f4.user = @user3
f4.followable = @user3
f4.save
f5 = Follow.new
f5.user = @user4
f5.followable = @user3
f5.save
# @user2
f6 = Follow.new
f6.user = @user1
f6.followable = @user2
f6.save
# @user4.followers.concat([@user2, @user3, @user4])
# @user3.followers.concat([@user3, @user4])
# @user2.followers.concat([@user4])
expect(@user4.followers.count).to be 3
get_query
good_response
musician = json["musicians"][0]
expect(musician["id"]).to eq(@user4.id)
followings = musician['followings']
# expect(followings.length).to be 3
expect(followings.length).to be 2
expect(musician['follow_count'].to_i).to be > 0
end