Skip to content

Commit

Permalink
Fixes empty my projects
Browse files Browse the repository at this point in the history
  • Loading branch information
shereefb committed Feb 13, 2011
1 parent 20e7b12 commit 0b1ba51
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ def belongs_to_projects
#returns list of recent projects with a max count #returns list of recent projects with a max count
def recent_projects(max = 10) def recent_projects(max = 10)
project_ids = ActivityStream.find_by_sql("SELECT project_id FROM Activity_Streams WHERE actor_id = #{self.id} AND updated_at > '#{Time.now.advance :days => (Setting::DAYS_FOR_RECENT_PROJECTS * -1)}' GROUP BY project_id ORDER BY MAX(updated_at) DESC LIMIT #{max}").collect {|a| a.project_id}.join(",") project_ids = ActivityStream.find_by_sql("SELECT project_id FROM Activity_Streams WHERE actor_id = #{self.id} AND updated_at > '#{Time.now.advance :days => (Setting::DAYS_FOR_RECENT_PROJECTS * -1)}' GROUP BY project_id ORDER BY MAX(updated_at) DESC LIMIT #{max}").collect {|a| a.project_id}.join(",")
return nil unless project_ids return [] unless project_ids.length > 0
Project.find(:all, :conditions => "id in (#{project_ids})") Project.find(:all, :conditions => "id in (#{project_ids})")
end end


Expand Down
2 changes: 2 additions & 0 deletions logfile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -202,3 +202,5 @@ ERROR: syntax error at or near "activity_streams" at character 205
STATEMENT: SELECT max("activity_streams".updated_at) AS max_updated_at, project_id,ActivityStream.find_by_sql("SELECT project_id :updated_at AS project_id_activitystream_find_by_sql_select_project_id_updated FROM "activity_streams" WHERE ("activity_streams"."actor_id" = 3) GROUP BY project_id,ActivityStream.find_by_sql("SELECT project_id :updated_at ORDER BY updated_at DESC STATEMENT: SELECT max("activity_streams".updated_at) AS max_updated_at, project_id,ActivityStream.find_by_sql("SELECT project_id :updated_at AS project_id_activitystream_find_by_sql_select_project_id_updated FROM "activity_streams" WHERE ("activity_streams"."actor_id" = 3) GROUP BY project_id,ActivityStream.find_by_sql("SELECT project_id :updated_at ORDER BY updated_at DESC
ERROR: column "project_ids" does not exist at character 40 ERROR: column "project_ids" does not exist at character 40
STATEMENT: SELECT * FROM "projects" WHERE (id in (project_ids)) STATEMENT: SELECT * FROM "projects" WHERE (id in (project_ids))
ERROR: syntax error at or near ")" at character 40
STATEMENT: SELECT * FROM "projects" WHERE (id in ())

0 comments on commit 0b1ba51

Please sign in to comment.