Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_forum
cxt 5 years ago
commit 16f7defd34

@ -1323,13 +1323,12 @@ class ExercisesController < ApplicationController
ActiveRecord::Base.transaction do
begin
exercise_ids = [@exercise.id]
@exercise_publish_count = get_user_permission_course(exercise_ids,2).count #判断是否有已发布的分班
@exercise_unpublish_count = get_user_permission_course(exercise_ids,1).count #判断是否有未发布的分班
@exercise_publish_count = get_user_permission_course(exercise_ids,Exercise::PUBLISHED).size #判断是否有已发布的分班
@exercise_unpublish_count = get_user_permission_course(exercise_ids,Exercise::UNPUBLISHED).size #判断是否有未发布的分班
@course_all_members = @course.students #课堂的全部学生
@exercise_all_users = @exercise.exercise_users
ex_common_ids = @exercise.common_published_ids(current_user.id)
@exercise_course_groups = @course.get_ex_published_course(ex_common_ids)
# @exercise_course_groups = @exercise.get_ex_published_course(current_user.id)
@exercise_users_list = @exercise.all_exercise_users(current_user.id)
@course_all_members_count = @exercise_users_list.size
@ -1342,7 +1341,7 @@ class ExercisesController < ApplicationController
end
@exercise_commit_users = @exercise_all_users.commit_exercise_by_status(1) #试卷的已提交用户
@exercise_commit_user_ids = @exercise_commit_users.pluck(:user_id).uniq #已提交试卷的全部用户id
@exercise_commit_user_counts = @exercise_commit_users.count #试卷的已提交用户人数
@exercise_commit_user_counts = @exercise_commit_users.size #试卷的已提交用户人数
@exercise_status = @exercise.get_exercise_status(current_user)
#提交率
@ -1394,7 +1393,7 @@ class ExercisesController < ApplicationController
@question_result_hash = ques_result_all.sort_by{|s| s["#{@paging_type}"]}
end
@exercise_questions_count = @exercise_questions.count
@exercise_questions_count = @exercise_questions.size
@page = params[:page] || 1
@limit = params[:limit] || 10
@question_result_hash = Kaminari.paginate_array(@question_result_hash).page(@page).per(@limit)

@ -89,7 +89,7 @@ module ExercisesHelper
questions.each do |ex|
ex_total_score = user_ids.count * ex&.question_score #该试卷的已回答的总分
ex_answers = ex.exercise_answers
if ex.question_type != 5
if ex.question_type != Exercise::PRACTICAL
ques_title = ex.question_title
ques_less_title = nil
effictive_users = ex_answers.search_answer_users("user_id",user_ids)
@ -106,7 +106,7 @@ module ExercisesHelper
percent = (ex_answered_scores / ex_total_score.to_f).round(3) * 100 #正确率
end
question_answer_infos = []
if ex.question_type <= 2 #单选题
if ex.question_type <= Exercise::JUDGMENT #单选题
standard_answer = ex.exercise_standard_answers.pluck(:exercise_choice_id) #标准答案的位置
ex.exercise_choices.each do |c|
right_answer = standard_answer.include?(c.choice_position) #选项的标准答案为选项的位置
@ -126,7 +126,7 @@ module ExercisesHelper
}
question_answer_infos.push(answer_option)
end
elsif ex.question_type == 3 #填空题
elsif ex.question_type == Exercise::COMPLETION #填空题
ex_ordered = ex.is_ordered
null_standard_answer = ex.exercise_standard_answers
null_stand_choice = null_standard_answer.pluck(:exercise_choice_id)
@ -179,7 +179,7 @@ module ExercisesHelper
:right_answer => false
}
question_answer_infos.push(wrong_answer_position)
elsif ex.question_type == 4 #主观题
elsif ex.question_type == Exercise::SUBJECTIVE #主观题
ex_score = ex&.question_score
full_scores = effictive_users.search_exercise_answer("score",ex_score).count #满分人数
no_full_scores = effictive_users.exercise_no_full_scores(ex_score).count #部分分数人数
@ -208,7 +208,7 @@ module ExercisesHelper
}
question_answer_infos.push(answer_option)
end
elsif ex.question_type == 5 #实训题
elsif ex.question_type == Exercise::PRACTICAL #实训题
ex.exercise_shixun_challenges.each do |c|
cha_score = c&.question_score
cha_shixun_answer = effictive_users.search_shixun_keys("exercise_shixun_challenge_id",c.id)

@ -32,7 +32,7 @@ json.commit_results do
json.ques_position q[:position]
json.right_percent q[:percent]
json.effictive_counts q[:ques_effictive_counts]
if q[:type] != 5
if q[:type] != Exercise::PRACTICAL
json.ques_details do
json.array! q[:ques_details] do |d|
json.choice_position d[:choice_position]

Loading…
Cancel
Save