我的资源--》课程资源下不应出现已删除课程的资源

This commit is contained in:
cxt 2016-07-05 16:48:20 +08:00
parent 3ccdf7f9ae
commit 83617f8475
1 changed files with 2 additions and 2 deletions

View File

@ -2767,7 +2767,7 @@ class UsersController < ApplicationController
# 获取我的课程资源
def get_course_resources author_id, user_course_ids, order, score
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Course')"+
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and container_type = 'Course')"+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})
and is_publish = 1 and container_id is not null)" ).order("#{order.nil? ? 'created_on' : order} #{score}")
end