commit
a28e0a70b8
@ -0,0 +1,13 @@
|
|||||||
|
# 删除课堂时将相应的课堂消息置为删除状态,并给老师发送删除消息
|
||||||
|
class DeleteCourseNotifyJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
def perform(course_id, user_id)
|
||||||
|
course = Course.find_by(id: course_id)
|
||||||
|
return if course.blank?
|
||||||
|
|
||||||
|
Tiding.where(belong_container: course).update_all(is_delete: 1)
|
||||||
|
Tiding.create!(user_id: user_id, trigger_user_id: user_id, container_id: course.id,
|
||||||
|
container_type: 'DeleteCourse', tiding_type: 'System', belong_container: course, extra: course.name)
|
||||||
|
end
|
||||||
|
end
|
@ -1,8 +1,15 @@
|
|||||||
json.main_category main_catrgory do |category|
|
json.main_category main_catrgory do |category|
|
||||||
json.main_category_id 0
|
json.main_category_id 0
|
||||||
json.main_category_name category.module_name
|
json.main_category_name category.module_name
|
||||||
|
homework_count = practice_homework_count category.course
|
||||||
|
json.publish_count homework_count[:publish_count]
|
||||||
|
json.unpublish_count homework_count[:unpublish_count]
|
||||||
|
json.all_count homework_count[:all_count]
|
||||||
end
|
end
|
||||||
json.homework_category homework_category do |category|
|
json.homework_category homework_category do |category|
|
||||||
json.category_id category.id
|
json.category_id category.id
|
||||||
json.category_name category.name
|
json.category_name category.name
|
||||||
|
json.publish_count category.homework_publish_count
|
||||||
|
json.unpublish_count category.homework_unpublish_count
|
||||||
|
json.all_count category.homework_commons.size
|
||||||
end
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe DeleteCourseNotifyJob, type: :job do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Loading…
Reference in new issue