修复获取当前用户建立项目不正确的问题

This commit is contained in:
sw 2014-06-19 16:52:53 +08:00
parent a764888055
commit 59e6433938
1 changed files with 9 additions and 5 deletions

View File

@ -56,13 +56,17 @@ module HomeworkAttachHelper
end end
def user_projects_option def user_projects_option
projects = Project.where("id < 8") cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
memberships = User.current.memberships.all(:conditions => cond)
projects = memberships.map(&:project)
type = [] type = []
projects.each do |project| projects.each do |project|
option = [] if project != nil
option << project.name option = []
option << project.id option << project.name
type << option option << project.id
type << option
end
end end
type type
end end