From 15753532fbbc7333c7022c77c46b5de17fc1f387 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 23 Dec 2019 18:22:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E6=95=B0=E6=8D=AE=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/excellent_course_exercise.rake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tasks/excellent_course_exercise.rake b/lib/tasks/excellent_course_exercise.rake index c3700957c..a8f860c2d 100644 --- a/lib/tasks/excellent_course_exercise.rake +++ b/lib/tasks/excellent_course_exercise.rake @@ -14,19 +14,19 @@ namespace :excellent_course_exercise do course = Course.find_by(id: course_id) course.exercises.each_with_index do |exercise, index| - # if exercise.exercise_users.where(commit_status: 1).count == 0 + if exercise.exercise_users.where(commit_status: 1).count == 0 # 第一个试卷的参与人数和通过人数都是传的数据,后续的随机 if index == 0 members = course.students.order("id asc").limit(participant_count) update_exercise_user(exercise, members, pass_count) else - new_participant_count = rand((participant_count - 423)..participant_count) - new_pass_count = rand((new_participant_count - 113)..new_participant_count) + new_participant_count = rand((participant_count - 20)..participant_count) + new_pass_count = rand((new_participant_count - 30)..new_participant_count) members = course.students.order("id asc").limit(new_participant_count) update_exercise_user(exercise, members, new_pass_count) end - # end + end end end