dev_forum
SylorHuang 5 years ago
parent 148b73d4ff
commit e946b06a9a

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

@ -257,7 +257,6 @@ module ExercisesHelper
end end
def exercise_index_show(exercise,course,is_teacher_or,user) def exercise_index_show(exercise,course,is_teacher_or,user)
# exercise_all_users = exercise.exercise_users
# lock_icon 0出现锁1不出现锁 # lock_icon 0出现锁1不出现锁
ex_show_text = [] ex_show_text = []

@ -36,7 +36,7 @@ elsif student_status == 1
json.question_status question_status json.question_status question_status
end end
exercise_status = exercise.get_exercise_status(ex_answerer.id) exercise_status = exercise.get_exercise_status(ex_answerer)
#当前为老师,或为学生,但在试卷截止后且答案选择公开的 #当前为老师,或为学生,但在试卷截止后且答案选择公开的
if is_teacher_or == 1 || (exercise_status == 3 && exercise.answer_open) if is_teacher_or == 1 || (exercise_status == 3 && exercise.answer_open)

Loading…
Cancel
Save