From 757f5aaa62e78d171a2ec2ac15c6b4aef84178e9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 12:55:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E9=93=BE=E6=8E=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 0f54adbc0..c20f77113 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -112,9 +112,11 @@ class CoursesController < ApplicationController videos = custom_sort(videos, params[:sort_by], params[:sort_direction]) @count = videos.count - sql = "left join videos on videos.id=course_videos.video_id AND (videos.transcoded=1 OR videos.user_id = #{current_user.id})" - videos = videos.joins(sql).reload! + #sql = "left join videos on videos.id=course_videos.video_id AND (videos.transcoded=1 OR videos.user_id = #{current_user.id})" + #@videos = paginate videos.joins(sql).includes(video: [user: :user_extension], user: :user_extension) @videos = paginate videos.includes(video: [user: :user_extension], user: :user_extension) + .where(videos: {transcoded: true}).or(videos: {user_id: current_user.id}) + .or(course_videos: {is_link: true}) end def delete_course_video