Still working on stream query

This commit is contained in:
Raphael Sofaer 2011-04-04 13:06:15 -07:00
parent d09bf35213
commit b48b483eab
3 changed files with 3 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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