Still working on stream query
This commit is contained in:
parent
d09bf35213
commit
b48b483eab
3 changed files with 3 additions and 3 deletions
|
|
@ -27,7 +27,7 @@ class AspectsController < ApplicationController
|
|||
@selected_contacts = @aspects.map { |aspect| aspect.contacts }.flatten.uniq
|
||||
@aspect_ids = @aspects.map { |a| a.id }
|
||||
@posts = current_user.raw_visible_posts(:by_members_of => @aspect_ids, :type => 'StatusMessage', :order => session[:sort_order] + ' DESC', :page => params[:page]).includes(
|
||||
:comments, :mentions, :likes, :dislikes).paginate(:page => params[:page], :per_page => 15, :order => session[:sort_order] + ' DESC')
|
||||
:comments, :mentions, :likes, :dislikes).paginate(:page => params[:page], :per_page => 15, :order => "posts.#{session[:sort_order]} DESC")
|
||||
@fakes = PostsFake.new(@posts)
|
||||
|
||||
@contact_count = current_user.contacts.count
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ module Diaspora
|
|||
post_ids = Post.connection.execute(posts_from_others.select('posts.id').limit(opts[:limit]).order(order_with_table).to_sql).map{|r| r.first}
|
||||
post_ids += Post.connection.execute(posts_from_self.select('posts.id').limit(opts[:limit]).order(order_with_table).to_sql).map{|r| r.first}
|
||||
|
||||
Post.where(:id => post_ids, :pending => false, :type => opts[:type]).select('DISTINCT `posts`.*').limit(opts[:limit]).order(opts[:order])
|
||||
Post.where(:id => post_ids, :pending => false, :type => opts[:type]).select('DISTINCT `posts`.*').limit(opts[:limit]).order(order_with_table)
|
||||
end
|
||||
|
||||
def visible_photos
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ describe User do
|
|||
context 'with many posts' do
|
||||
before do
|
||||
bob.move_contact(eve.person, bob.aspects.first, bob.aspects.create(:name => 'new aspect'))
|
||||
(1..18).each do |n|
|
||||
(1..25).each do |n|
|
||||
[alice, bob, eve].each do |u|
|
||||
post = u.post :status_message, :text => "#{u.username} - #{n}", :to => u.aspects.first.id
|
||||
post.created_at = post.created_at - n*10*u.id
|
||||
|
|
|
|||
Loading…
Reference in a new issue