|
|
@ -1519,7 +1519,7 @@ class ExercisesController < ApplicationController
|
|
|
|
if exercise.present?
|
|
|
|
if exercise.present?
|
|
|
|
if exercise.unified_setting #统一设置只有两种情况,全部发布,全部截止
|
|
|
|
if exercise.unified_setting #统一设置只有两种情况,全部发布,全部截止
|
|
|
|
exercise_user_status = exercise.get_exercise_status(current_user) #当前用户的能看到的试卷
|
|
|
|
exercise_user_status = exercise.get_exercise_status(current_user) #当前用户的能看到的试卷
|
|
|
|
if (exercise_user_status == exercise_status) || exercise_status == Exercise::ENDED #未发布的情况
|
|
|
|
if (exercise_user_status == exercise_status) || exercise_status == Exercise::DEADLINE #未发布的情况
|
|
|
|
unpublish_group = unpublish_group + user_groups_id
|
|
|
|
unpublish_group = unpublish_group + user_groups_id
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -1527,7 +1527,7 @@ class ExercisesController < ApplicationController
|
|
|
|
ex_group_settings = ex_all_group_settings.exercise_group_published.pluck(:course_group_id).uniq #问卷设置的班级
|
|
|
|
ex_group_settings = ex_all_group_settings.exercise_group_published.pluck(:course_group_id).uniq #问卷设置的班级
|
|
|
|
if exercise_status == Exercise::UNPUBLISHED
|
|
|
|
if exercise_status == Exercise::UNPUBLISHED
|
|
|
|
unpublish_group = user_groups_id - ex_group_settings
|
|
|
|
unpublish_group = user_groups_id - ex_group_settings
|
|
|
|
elsif exercise_status == Exercise::ENDED
|
|
|
|
elsif exercise_status == Exercise::DEADLINE
|
|
|
|
ex_ended_groups = ex_all_group_settings.exercise_group_ended.pluck(:course_group_id).uniq
|
|
|
|
ex_ended_groups = ex_all_group_settings.exercise_group_ended.pluck(:course_group_id).uniq
|
|
|
|
ex_and_user = user_groups_id & ex_group_settings #用户已设置的分班
|
|
|
|
ex_and_user = user_groups_id & ex_group_settings #用户已设置的分班
|
|
|
|
unpublish_group = unpublish_group + ex_and_user - ex_ended_groups #已发布的全部班级减去截止的全部班级
|
|
|
|
unpublish_group = unpublish_group + ex_and_user - ex_ended_groups #已发布的全部班级减去截止的全部班级
|
|
|
@ -1627,7 +1627,7 @@ class ExercisesController < ApplicationController
|
|
|
|
def check_exercise_public
|
|
|
|
def check_exercise_public
|
|
|
|
if @user_course_identity > Course::ASSISTANT_PROFESSOR #当前为学生,试卷公开统计,且已截止,且已提交
|
|
|
|
if @user_course_identity > Course::ASSISTANT_PROFESSOR #当前为学生,试卷公开统计,且已截止,且已提交
|
|
|
|
ex_user = @exercise.exercise_users.exercise_commit_users(current_user.id).first
|
|
|
|
ex_user = @exercise.exercise_users.exercise_commit_users(current_user.id).first
|
|
|
|
unless @exercise.get_exercise_status(current_user) == Exercise::ENDED && ex_user.present? && ex_user.commit_status == 1 &&
|
|
|
|
unless @exercise.get_exercise_status(current_user) == Exercise::DEADLINE && ex_user.present? && ex_user.commit_status == 1 &&
|
|
|
|
@exercise.show_statistic
|
|
|
|
@exercise.show_statistic
|
|
|
|
normal_status(-1,"学生暂不能查看")
|
|
|
|
normal_status(-1,"学生暂不能查看")
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -1650,7 +1650,7 @@ class ExercisesController < ApplicationController
|
|
|
|
ex_question_random = exercise.question_random
|
|
|
|
ex_question_random = exercise.question_random
|
|
|
|
question_answered = 0
|
|
|
|
question_answered = 0
|
|
|
|
exercise_questions.each_with_index do |q,index|
|
|
|
|
exercise_questions.each_with_index do |q,index|
|
|
|
|
if ex_question_random && exercise_user_status != Exercise::ENDED
|
|
|
|
if ex_question_random && exercise_user_status != Exercise::DEADLINE
|
|
|
|
ques_number = index + 1
|
|
|
|
ques_number = index + 1
|
|
|
|
else
|
|
|
|
else
|
|
|
|
ques_number = q.question_number
|
|
|
|
ques_number = q.question_number
|
|
|
|