试卷的复制

dev_chen
cxt 5 years ago
parent 971d3ed6a8
commit 179e09b422

@ -66,7 +66,7 @@ class Hack < ApplicationRecord
# 复制fork # 复制fork
def fork def fork
new_hack = Hack.new new_hack = Hack.new
new_hack.attributes = self.attributes.dup.except("id", "user_id", "status", "identifier", "comments_count", "praises_count", new_hack.attributes = self.attributes.dup.except("id", "user_id", "identifier", "comments_count", "praises_count",
"pass_num", "created_at", "updated_at", "hack_user_lastest_codes_count", "pass_num", "created_at", "updated_at", "hack_user_lastest_codes_count",
"open_or_not", "submit_num") "open_or_not", "submit_num")
new_hack.user_id = User.current.id new_hack.user_id = User.current.id

@ -22,6 +22,7 @@ class ExaminationBanks::SendToCourseService < ApplicationService
if item.item_type == "PROGRAM" if item.item_type == "PROGRAM"
new_hack = item.container.fork new_hack = item.container.fork
new_hack.update!(status: 1)
question.hack_id = new_hack.id question.hack_id = new_hack.id
question.save! question.save!
else else

Loading…
Cancel
Save