|
|
|
@ -2,10 +2,10 @@ class MigrateStudentWorkCompeleteStatus < ActiveRecord::Migration[5.2]
|
|
|
|
|
def change
|
|
|
|
|
student_works = StudentWork.where("myshixun_id is not null and myshixun_id != 0")
|
|
|
|
|
student_works.includes(homework_common: :homework_challenge_settings, myshixun: :games).find_each do |work|
|
|
|
|
|
if work.myshixun
|
|
|
|
|
if work.myshixun && work.homework_common
|
|
|
|
|
myshixun = work.myshixun
|
|
|
|
|
homework= work.homework_common
|
|
|
|
|
setting_time = homework.homework_group_setting myshixun.user_id
|
|
|
|
|
setting_time = homework.homework_group_setting(myshixun.user_id)
|
|
|
|
|
homework_end_or_late_time = homework.allow_late ? homework.late_time : setting_time.end_time
|
|
|
|
|
challenge_ids = homework.homework_challenge_settings.pluck(:challenge_id)
|
|
|
|
|
games = myshixun.games.select{ |game| challenge_ids.include?(game.challenge_id) }
|
|
|
|
|