dev_course
SylorHuang 5 years ago
parent 9b8887fa0f
commit f6a6a5e98d

@ -105,8 +105,7 @@ class ExercisesController < ApplicationController
@course_all_members_count = @course_all_members.size #当前课堂的学生数 @course_all_members_count = @course_all_members.size #当前课堂的学生数
@exercises_count = @exercises_all.size # 全部页面,需返回 @exercises_count = @exercises_all.size # 全部页面,需返回
@exercises_unpublish_counts = @exercises_all.exercise_by_status(1).size #未发布的试卷数 @exercises_unpublish_counts = @exercises_all.exercise_by_status(1).size #未发布的试卷数
@exercises_published_counts = @exercises_all.exercise_by_status([2,3]).size # 已发布的试卷数,包含已截止的 @exercises_published_counts = @exercises_count - @exercises_unpublish_counts # 已发布的试卷数,包含已截止的
@exercises_ended_counts = @exercises_all.exercise_by_status(3).size #已截止的试卷数
rescue Exception => e rescue Exception => e
uid_logger_error(e.message) uid_logger_error(e.message)

@ -69,11 +69,7 @@ class Exercise < ApplicationRecord
def common_published_ids(user_id) def common_published_ids(user_id)
current_user_groups = course.teacher_course_ids(user_id) current_user_groups = course.teacher_course_ids(user_id)
if unified_setting if unified_setting
if course.none_group_count > 0 #有未分班的,则发布到未发布分班 un_group_ids = (course.none_group_count > 0) ? [0] : []
un_group_ids = [0]
else
un_group_ids = []
end
published_group_ids = (current_user_groups + un_group_ids).uniq #统一设置时为当前用户的分班id及未分班 published_group_ids = (current_user_groups + un_group_ids).uniq #统一设置时为当前用户的分班id及未分班
else else
ex_group_setting = exercise_group_settings.pluck("course_group_id").uniq ex_group_setting = exercise_group_settings.pluck("course_group_id").uniq
@ -89,11 +85,7 @@ class Exercise < ApplicationRecord
ex_group_settings = exercise_group_settings.pluck(:course_group_id) ex_group_settings = exercise_group_settings.pluck(:course_group_id)
member = course.course_members.course_find_by_ids("user_id",user_id) member = course.course_members.course_find_by_ids("user_id",user_id)
member_group_id = member.pluck(:course_group_id).uniq member_group_id = member.pluck(:course_group_id).uniq
if (member_group_id & ex_group_settings).size > 0 || user_identity < Course::STUDENT ((member_group_id & ex_group_settings).size > 0 || user_identity < Course::STUDENT) ? true : false
true
else
false
end
end end
#判断是否为分班,如果分班,试卷的截止时间为当前分班时间,否则为试卷的截止时间 #判断是否为分班,如果分班,试卷的截止时间为当前分班时间,否则为试卷的截止时间

Loading…
Cancel
Save