|
|
|
@ -32,13 +32,9 @@ class ExercisesController < ApplicationController
|
|
|
|
|
@exercises_all = @course.exercises
|
|
|
|
|
member_show_exercises = @exercises_all.is_exercise_published #已发布的或已截止的试卷
|
|
|
|
|
@current_user_ = current_user
|
|
|
|
|
@exercises_count = @exercises_all.size # 全部页面,需返回
|
|
|
|
|
@exercises_unpublish_counts = @exercises_all.exercise_by_status(1).size #未发布的试卷数
|
|
|
|
|
@exercises_published_counts = @exercises_all.exercise_by_status([2,3]).size # 已发布的试卷数,包含已截止的
|
|
|
|
|
@exercises_ended_counts = @exercises_all.exercise_by_status(3).size #已截止的试卷数
|
|
|
|
|
|
|
|
|
|
# 课堂的学生人数
|
|
|
|
|
@course_all_members = @course.students #当前课堂的全部学生
|
|
|
|
|
@course_all_members_count = @course_all_members.size #当前课堂的学生数
|
|
|
|
|
@current_student = @course_all_members.course_find_by_ids("user_id",current_user.id) #当前用户是否为课堂的学生
|
|
|
|
|
|
|
|
|
|
# exercises的不同用户群体的显示
|
|
|
|
@ -63,6 +59,7 @@ class ExercisesController < ApplicationController
|
|
|
|
|
@is_teacher_or = 0
|
|
|
|
|
@exercises = member_show_exercises.exists? ? member_show_exercises.unified_setting : []
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if @exercises.size > 0
|
|
|
|
|
if params[:type].present?
|
|
|
|
|
choose_type = params[:type].to_i
|
|
|
|
@ -105,6 +102,12 @@ class ExercisesController < ApplicationController
|
|
|
|
|
@exercises = []
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@course_all_members_count = @course_all_members.size #当前课堂的学生数
|
|
|
|
|
@exercises_count = @exercises_all.size # 全部页面,需返回
|
|
|
|
|
@exercises_unpublish_counts = @exercises_all.exercise_by_status(1).size #未发布的试卷数
|
|
|
|
|
@exercises_published_counts = @exercises_all.exercise_by_status([2,3]).size # 已发布的试卷数,包含已截止的
|
|
|
|
|
@exercises_ended_counts = @exercises_all.exercise_by_status(3).size #已截止的试卷数
|
|
|
|
|
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
uid_logger_error(e.message)
|
|
|
|
|
tip_exception(e.message)
|
|
|
|
|