diff --git a/app/models/profile_list_block.rb b/app/models/profile_list_block.rb index 7c7f271..b6d1a0d 100644 --- a/app/models/profile_list_block.rb +++ b/app/models/profile_list_block.rb @@ -19,10 +19,10 @@ class ProfileListBlock < Block visible_profiles = profiles.visible.includes([:image,:domains,:preferred_domain,:environment]) if !prioritize_profiles_with_image result = visible_profiles.all(:limit => limit, :order => 'updated_at DESC').sort_by{ rand } - elsif visible_profiles.with_image.count >= limit + elsif profiles.visible.with_image.count >= limit result = visible_profiles.with_image.all(:limit => limit * 5, :order => 'updated_at DESC').sort_by{ rand } else - result = visible_profiles.with_image.sort_by{ rand } + visible_profiles.without_image.all(:limit => limit * 5, :order => 'updated_at DESC').sort_by{ rand } + result = visible_profiles.with_image.sort_by{ rand } + visible_profiles.without_image.all(:limit => limit * 5, :order => 'profiles.updated_at DESC').sort_by{ rand } end result.slice(0..limit-1) end -- libgit2 0.21.2