实训作业创建作品

topic_bank
cxt 5 years ago
parent f23180e5c8
commit 1250c6e664

@ -930,6 +930,7 @@ class HomeworkCommonsController < ApplicationController
shixuns.each do |shixun| shixuns.each do |shixun|
homework = HomeworksService.new.create_homework shixun, @course, @category, current_user homework = HomeworksService.new.create_homework shixun, @course, @category, current_user
@homework_ids << homework.id @homework_ids << homework.id
CreateStudentWorkJob.perform_later(homework.id)
end end
rescue Exception => e rescue Exception => e
uid_logger(e.message) uid_logger(e.message)
@ -1031,6 +1032,7 @@ class HomeworkCommonsController < ApplicationController
stage.shixuns.where.not(shixuns: {id: none_shixun_ids}).unhidden.each do |shixun| stage.shixuns.where.not(shixuns: {id: none_shixun_ids}).unhidden.each do |shixun|
homework = HomeworksService.new.create_homework shixun, @course, category, current_user homework = HomeworksService.new.create_homework shixun, @course, category, current_user
@homework_ids << homework.id @homework_ids << homework.id
CreateStudentWorkJob.perform_later(homework.id)
end end
end end
end end

@ -909,6 +909,7 @@ class ShixunsController < ApplicationController
def send_to_course def send_to_course
@course = Course.find(params[:course_id]) @course = Course.find(params[:course_id])
homework = HomeworksService.new.create_homework @shixun, @course, nil, current_user homework = HomeworksService.new.create_homework @shixun, @course, nil, current_user
CreateStudentWorkJob.perform_later(homework.id)
end end
# 二维码扫描下载 # 二维码扫描下载

@ -214,6 +214,7 @@ class SubjectsController < ApplicationController
stage.shixuns.where(id: params[:shixun_ids], status: 2).each do |shixun| stage.shixuns.where(id: params[:shixun_ids], status: 2).each do |shixun|
homework = HomeworksService.new.create_homework shixun, @course, category, current_user homework = HomeworksService.new.create_homework shixun, @course, category, current_user
CreateStudentWorkJob.perform_later(homework.id)
end end
end end
rescue Exception => e rescue Exception => e

@ -15,7 +15,6 @@ class HomeworksService
homework_detail_manual.save! if homework_detail_manual homework_detail_manual.save! if homework_detail_manual
HomeworkCommonsShixun.create!(homework_common_id: homework.id, shixun_id: shixun.id) HomeworkCommonsShixun.create!(homework_common_id: homework.id, shixun_id: shixun.id)
HomeworksService.new.create_shixun_homework_cha_setting(homework, shixun) HomeworksService.new.create_shixun_homework_cha_setting(homework, shixun)
CreateStudentWorkJob.perform_later(homework.id)
# HomeworksService.new.create_works_list(homework, course) # HomeworksService.new.create_works_list(homework, course)
end end
homework homework

Loading…
Cancel
Save