Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes empty my projects

  • Loading branch information...
commit 0b1ba51787831d1f1f140c3877ef00b40edfca2b 1 parent 20e7b12
@shereefb shereefb authored
Showing with 3 additions and 1 deletion.
  1. +1 −1  app/models/user.rb
  2. +2 −0  logfile
View
2  app/models/user.rb
@@ -641,7 +641,7 @@ def belongs_to_projects
#returns list of recent projects with a max count
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(",")
- return nil unless project_ids
+ return [] unless project_ids.length > 0
Project.find(:all, :conditions => "id in (#{project_ids})")
end
View
2  logfile
@@ -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
ERROR: column "project_ids" does not exist at character 40
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.
Something went wrong with that request. Please try again.