@ -414,6 +413,9 @@ class CoursesController < ApplicationController
end
defsettings
#添加成员消息状态
join_course_messages=CourseMessage.where("user_id =? and course_message_type =? and course_id =? and status = ? and viewed =?",User.current.id,'JoinCourse',@course.id,1,0)
join_course_messages.update_all(:viewed=>true)
ifUser.current.allowed_to?(:as_teacher,@course)
@select_tab=params[:tab]
@issue_custom_fields=IssueCustomField.sorted.all
@ -889,25 +891,28 @@ class CoursesController < ApplicationController
@courses=@syllabus.courses.where("is_delete = 0").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name}#{sort_type}")
else
@courses=User.current.courses.visible.where("is_delete =? and syllabus_id =?",0,@syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name}#{sort_type}")
end
@courses=@syllabus.courses.where("is_delete = ?",0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name}#{sort_type}")
@homeworks=HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and course_id not in #{course_ids}").order("#{@order}#{@b_sort}")
@type=params[:type]
@limit=15
@is_remote=true
@ -933,6 +949,7 @@ class UsersController < ApplicationController
@student_work=StudentWork.new
end
@course=@homework.course
@left_nav_type=3
respond_todo|format|
format.js
format.html{render:layout=>'base_courses'}
@ -1549,7 +1566,11 @@ class UsersController < ApplicationController
when"current_user"
@user_activities=UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('updated_at desc').limit(10).offset(@page*10)
@user_activities=UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})"+
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) "+
@ -1559,8 +1580,12 @@ class UsersController < ApplicationController
# @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10)