|
|
|
@ -219,7 +219,6 @@ class ExercisesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
uid_logger_error(e.message)
|
|
|
|
|
tip_exception("没有权限")
|
|
|
|
@ -1206,8 +1205,6 @@ class ExercisesController < ApplicationController
|
|
|
|
|
get_exercise_answers(@exercise_all_users) # 未答和已答的
|
|
|
|
|
@exercise_current_user_status = 2 #当前用户非课堂成员
|
|
|
|
|
@exercise_users_list = []
|
|
|
|
|
# @exercise_unanswers = 0
|
|
|
|
|
# @exercise_answers = 0
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -1296,7 +1293,6 @@ class ExercisesController < ApplicationController
|
|
|
|
|
get_export_users(@exercise,@course,@export_ex_users)
|
|
|
|
|
exercise_export_name_ =
|
|
|
|
|
"#{current_user.real_name}_#{@course.name}_#{@exercise.exercise_name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
|
|
|
|
|
|
|
|
|
|
render xlsx: "#{exercise_export_name_.strip.first(30)}",template: "exercises/exercise_lists.xlsx.axlsx",locals: {table_columns:@table_columns,exercise_users:@user_columns}
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
@ -1314,9 +1310,9 @@ class ExercisesController < ApplicationController
|
|
|
|
|
def export_exercise
|
|
|
|
|
@request_url = request.base_url
|
|
|
|
|
@exercise_questions = @exercise.exercise_questions.includes(:exercise_choices).order("question_number ASC")
|
|
|
|
|
filename_ = "#{@exercise.user.real_name}_#{@exercise.exercise_name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
|
|
|
|
|
filename_ = "#{@exercise.user.real_name}_#{@course.name}__#{Time.now.strftime('%Y%m%d_%H%M%S')}"
|
|
|
|
|
stylesheets = "#{Rails.root}/app/templates/exercise_export/exercise_export.css"
|
|
|
|
|
render pdf: 'exercise_export/blank_exercise', filename: filename_.strip.first(30), stylesheets: stylesheets
|
|
|
|
|
render pdf: 'exercise_export/blank_exercise', filename: filename_, stylesheets: stylesheets
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#空白试卷预览页面,仅供测试使用,无其他任何用途
|
|
|
|
@ -1546,12 +1542,11 @@ class ExercisesController < ApplicationController
|
|
|
|
|
if exercise.present?
|
|
|
|
|
if exercise.unified_setting #统一设置只有两种情况,全部发布,全部截止
|
|
|
|
|
exercise_user_status = exercise.get_exercise_status(current_user) #当前用户的能看到的试卷
|
|
|
|
|
if exercise_user_status == exercise_status || exercise_status == 3 #未发布的情况
|
|
|
|
|
if (exercise_user_status == exercise_status) || exercise_status == 3 #未发布的情况
|
|
|
|
|
unpublish_group = unpublish_group + user_groups_id
|
|
|
|
|
else
|
|
|
|
|
unpublish_group = []
|
|
|
|
|
end
|
|
|
|
|
# unpublish_group = unpublish_group + user_groups_id
|
|
|
|
|
else
|
|
|
|
|
ex_all_group_settings = exercise.exercise_group_settings
|
|
|
|
|
ex_group_settings = ex_all_group_settings.exercise_group_published.pluck(:course_group_id).uniq #问卷设置的班级
|
|
|
|
@ -1579,13 +1574,13 @@ class ExercisesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def set_exercise_status(publish_time,end_time)
|
|
|
|
|
time_now_i = Time.now
|
|
|
|
|
if publish_time.present? && publish_time <= time_now_i && end_time > time_now_i
|
|
|
|
|
if publish_time.present? && (publish_time <= time_now_i) && (end_time > time_now_i)
|
|
|
|
|
2
|
|
|
|
|
elsif publish_time.nil? || (publish_time.present? && publish_time > time_now_i)
|
|
|
|
|
1
|
|
|
|
|
elsif end_time.present? && end_time <= time_now_i
|
|
|
|
|
elsif end_time.present? && (end_time <= time_now_i)
|
|
|
|
|
3
|
|
|
|
|
elsif end_time.present? && publish_time.present? && end_time < publish_time
|
|
|
|
|
elsif end_time.present? && publish_time.present? && (end_time < publish_time)
|
|
|
|
|
normal_status(-1,"时间设置错误!")
|
|
|
|
|
else
|
|
|
|
|
1
|
|
|
|
@ -1752,6 +1747,4 @@ class ExercisesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|