|
|
|
@ -24,6 +24,8 @@ class CreateShixunStudentWorks < ActiveRecord::Migration
|
|
|
|
|
shixun = work.homework_common.try(:homework_commons_shixuns).try(:shixun)
|
|
|
|
|
user = work.user
|
|
|
|
|
if shixun.present? && user.present?
|
|
|
|
|
myshixun = Myshixun.where(:user_id => user.id, :shixun_id => shixun.id).first
|
|
|
|
|
if myshixun.blank?
|
|
|
|
|
# 创建新的myshixun和games
|
|
|
|
|
# fork版本库,如果用户没有同步,则先同步用户
|
|
|
|
|
g = Gitlab.client
|
|
|
|
@ -68,6 +70,7 @@ class CreateShixunStudentWorks < ActiveRecord::Migration
|
|
|
|
|
Game.create!(:challenge_id => challenge.id, :myshixun_id => myshixun.id, :status => status, :user_id => myshixun.user_id,
|
|
|
|
|
:open_time => Time.now, :identifier => code, :modify_time => challenge.modify_time)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
work_score = work.final_score
|
|
|
|
|
work.homework_common.homework_challenge_settings.each do |setting|
|
|
|
|
|
if work_score > 1
|
|
|
|
|