commit
1694ae7f48
@ -0,0 +1,9 @@
|
||||
class AddMessageCountForBoards < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
boards = Board.where(:parent_id => 0)
|
||||
Board.reset_column_information
|
||||
boards.find_each do |board|
|
||||
Board.reset_counters board.id, :messages
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,18 @@
|
||||
class ChangeExericse1936Scores < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
#1936的试卷成绩有问题。
|
||||
# #https://www.educoder.net/courses/2935/exercises/1936/users/pizfnr5ts
|
||||
ex_special = Exercise.find_by_id(1936)
|
||||
ex_special_users = ex_special&.exercise_users&.exercise_user_committed&.where("end_at is not null and end_at > ?",Time.now - 2.months)
|
||||
if ex_special.present? && ex_special_users.exists?
|
||||
ex_special_users.each do |ex_user|
|
||||
calculate_score = calculate_student_score(ex_special,ex_user.user)[:total_score]
|
||||
subjective_score = ex_user.subjective_score
|
||||
total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
|
||||
total_score = calculate_score + total_score_subjective_score
|
||||
ex_user.update_attributes(score:total_score,objective_score:calculate_score)
|
||||
puts ex_user.id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in new issue