|
|
|
@ -36,14 +36,15 @@ namespace :excellent_course_exercise do
|
|
|
|
|
# index < pass_count 之前的学生都是通关的,之后的未通过
|
|
|
|
|
members.each_with_index do |member, index|
|
|
|
|
|
exercise_user = exercise.exercise_users.where(user_id: member.user_id).take
|
|
|
|
|
if exercise_question_ids.length == 20
|
|
|
|
|
question_length = exercise_question_ids.length
|
|
|
|
|
if question_length == 20
|
|
|
|
|
rand_num = index < pass_count - 1 ? rand(15..20) : rand(1..10)
|
|
|
|
|
elsif exercise_question_ids.length == 17
|
|
|
|
|
elsif question_length == 17
|
|
|
|
|
rand_num = index < pass_count - 1 ? rand(12..17) : rand(1..9)
|
|
|
|
|
elsif exercise_question_ids.length == 39
|
|
|
|
|
elsif question_length == 39
|
|
|
|
|
rand_num = index < pass_count - 1 ? rand(30..39) : rand(1..18)
|
|
|
|
|
else
|
|
|
|
|
rand_num = exercise_question_ids.length
|
|
|
|
|
rand_num = index < pass_count - 1 ? rand((question_length-3)..question_length) : rand(1..(question_length-8))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if exercise_user && exercise_user.commit_status == 0
|
|
|
|
|