已经删除了的课程还显示在新建作业的发布课程列表中

This commit is contained in:
cxt 2016-01-08 09:46:07 +08:00
parent 2de42afdae
commit 2d73933f4f
1 changed files with 1 additions and 1 deletions

View File

@ -591,7 +591,7 @@ module UsersHelper
option << "请选择发布作业的课程"
option << -1
type << option
user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").select{|c| user.allowed_to?(:as_teacher,c)}.each do |course|
user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").select{|c| user.allowed_to?(:as_teacher,c)}.each do |course|
option = []
option << course.name+""+course.time.to_s+course.term+""
option << course.id