将未命名课程去掉
This commit is contained in:
parent
4a7fb0e0b5
commit
f63df877db
|
@ -29,19 +29,13 @@ class SyllabusesService
|
|||
end
|
||||
#获取指定用户的课程大纲
|
||||
def user_syllabus(user)
|
||||
courses = CoursesService.new.user_courses_list(user)
|
||||
|
||||
other = Syllabus.new(title: '未命名课程',user_id: user.id)
|
||||
|
||||
courses.each do |c|
|
||||
other.courses << c[:course] unless c[:course].syllabus
|
||||
end
|
||||
|
||||
# user.syllabuses.each do |syllabus|
|
||||
# syllabus.courses = syllabus.courses.not_deleted
|
||||
# end
|
||||
# courses = CoursesService.new.user_courses_list(user)
|
||||
#
|
||||
# user.syllabuses.to_a << other
|
||||
# other = Syllabus.new(title: '未命名课程',user_id: user.id)
|
||||
#
|
||||
# courses.each do |c|
|
||||
# other.courses << c[:course] unless c[:course].syllabus
|
||||
# end
|
||||
|
||||
courses = user.courses.not_deleted
|
||||
syllabus_ids = courses.empty? ? '(-1)' : "(" + courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
|
||||
|
@ -51,8 +45,9 @@ class SyllabusesService
|
|||
syllabus.courses = courses.where("syllabus_id = #{syllabus.id}").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("time desc")
|
||||
end
|
||||
|
||||
syllabuses.to_a << other
|
||||
# syllabuses.to_a << other
|
||||
|
||||
syllabuses.to_a
|
||||
#管理权限 can_setting
|
||||
syllabuses.each do |s|
|
||||
s = judge_can_setting(s,user)
|
||||
|
|
Loading…
Reference in New Issue