@ -114,10 +114,10 @@ class CoursesController < ApplicationController
#sql = "left join videos on videos.id=course_videos.video_id AND (videos.transcoded=1 OR videos.user_id = #{current_user.id})"
#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.joins(sql).includes(video: [user: :user_extension], user: :user_extension)
videos = videos . jo ins( : video) . select ( " course_videos.id, course_videos.title, course_videos.link, course_videos. is_link,course_videos. user_id, course_videos.video _id" )
videos = videos . include s( video: [ user : :user_extension ] , user : :user_extension ) . select ( " course_videos.id, course_videos.title, course_videos.link, course_videos. user_id" )
videos = videos . where ( videos : { transcoded : true } )
videos = videos . where ( videos : { transcoded : true } )
. or ( videos . where ( videos : { user_id : current_user . id } ) )
. or ( videos . where ( videos : { user_id : current_user . id } ) )
. or ( videos . where ( course_videos : { is_link : true } ) ) . includes ( video : [ user : :user_extension ] , user : :user_extension )
. or ( videos . where ( course_videos : { is_link : true } ) )
@count = videos . count ( " course_videos.id " )
@count = videos . count ( " course_videos.id " )
logger . info ( " # # # # # # # count: #{ @count } " )
logger . info ( " # # # # # # # count: #{ @count } " )
@videos = paginate videos
@videos = paginate videos