Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_forum
hjm 5 years ago
commit e882695737

@ -147,17 +147,18 @@ class QuestionBanksController < ApplicationController
new_homework.homework_detail_group.base_on_project = homework.base_on_project new_homework.homework_detail_group.base_on_project = homework.base_on_project
end end
# 附件 # 附件
logger.info("######attachments: #{homework.attachments.count}")
if new_homework.save!
homework.attachments.try(:each) do |attachment| homework.attachments.try(:each) do |attachment|
att = attachment.copy att = attachment.copy
att.container_id = nil att.container_id = nil
att.container_type = nil att.container_type = nil
att.author_id = homework.user_id att.author_id = homework.user_id
att.copy_from = attachment.id att.copy_from = attachment.id
att.save att.save!
new_homework.attachments << att new_homework.attachments << att
end end
logger.info("######new_homework.attachments: #{new_homework.attachments.count}")
if new_homework.save
new_homework_detail_manual.save if new_homework_detail_manual new_homework_detail_manual.save if new_homework_detail_manual
new_homework.homework_detail_group.save if new_homework.homework_detail_group new_homework.homework_detail_group.save if new_homework.homework_detail_group
HomeworksService.new.create_works_list(new_homework, course) HomeworksService.new.create_works_list(new_homework, course)

@ -830,8 +830,6 @@ private
def is_shixun_reset?(games, min_challenges, current_myshixun) def is_shixun_reset?(games, min_challenges, current_myshixun)
# 用户在申请发布之前,是否玩过实训 TODO: 重置的字段应该迁移到myshixuns表比较合适 # 用户在申请发布之前,是否玩过实训 TODO: 重置的字段应该迁移到myshixuns表比较合适
modify_shixun = ShixunModify.exists?(:myshixun_id => current_myshixun.id, :shixun_id => @shixun.id, :status => 1) modify_shixun = ShixunModify.exists?(:myshixun_id => current_myshixun.id, :shixun_id => @shixun.id, :status => 1)
games.size != min_challenges.size || games.size != min_challenges.size || modify_shixun
games.map(&:challenge_id) != min_challenges.map{|challenge| challenge.first} ||
modify_shixun
end end
end end

Loading…
Cancel
Save