# 这写变量发现没有用而且拖慢速度

#@teachers= searchTeacherAndAssistant(@course)
    #@canShowRealName = isCourseTeacher(User.current.id,@course)
This commit is contained in:
lizanle 2015-01-30 10:27:21 +08:00
parent 3637d1906d
commit f3f590a834
1 changed files with 5 additions and 4 deletions

View File

@ -828,6 +828,7 @@ class CoursesController < ApplicationController
end end
def show def show
# try to redirect to the requested menu item # try to redirect to the requested menu item
if params[:jump] && redirect_to_course_menu_item(@course, params[:jump]) if params[:jump] && redirect_to_course_menu_item(@course, params[:jump])
return return
@ -866,6 +867,7 @@ class CoursesController < ApplicationController
@activity.scope_select {|t| has["show_#{t}"]} @activity.scope_select {|t| has["show_#{t}"]}
# modify by nwb # modify by nwb
# 添加私密性判断 # 添加私密性判断
if User.current.member_of_course?(@course)|| User.current.admin? if User.current.member_of_course?(@course)|| User.current.admin?
events = @activity.events(@days, @course.created_at) events = @activity.events(@days, @course.created_at)
else else
@ -890,14 +892,13 @@ class CoursesController < ApplicationController
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)} @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
# documents # documents
@sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category' @sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category'
# # 这写变量发现没有用而且拖慢速度
@teachers= searchTeacherAndAssistant(@course) #@teachers= searchTeacherAndAssistant(@course)
@canShowRealName = isCourseTeacher(User.current.id,@course) #@canShowRealName = isCourseTeacher(User.current.id,@course)
if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id))) if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id)))
@user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id) @user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id)
end end
respond_to do |format| respond_to do |format|
format.html{render :layout => 'base_courses'} format.html{render :layout => 'base_courses'}
format.api format.api