Merge branches 'dev_aliyun' and 'dev_new_shixunsrepository' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_new_shixunsrepository

dev_new_shixunsrepository
杨树明 5 years ago
commit 5aaa47c3c5

@ -984,7 +984,7 @@ class HomeworkCommonsController < ApplicationController
homework.homework_detail_manual.update_attributes!(comment_status: 1)
if homework.course_act.blank?
homework.course_act << CourseActivity.new(user_id: homework.user_id, course_id: homework.course_id)
CourseActivity.create!(user_id: homework.user_id, course_id: homework.course_id, course_act: homework)
end
# 发消息
HomeworkCommonPushNotifyJob.perform_later(homework.id, tiding_group_ids)
@ -1117,7 +1117,7 @@ class HomeworkCommonsController < ApplicationController
def choose_category
@main_catrgory = @course.course_modules.where(module_type: "shixun_homework")
@homework_category = @main_catrgory.take.course_second_categories
@homework_category = @main_catrgory.take.course_second_categories.includes(:homework_commons)
end
# 实训作业移动到目录

@ -302,7 +302,7 @@ class Course < ApplicationRecord
#课程动态公共表记录
def act_as_course_activity
self.course_act << CourseActivity.new(user_id: tea_id, course_id: id)
CourseActivity.create(user_id: tea_id, course_id: id, course_act: self)
end
# 当前老师分班下的所有学生

@ -30,7 +30,7 @@ class CourseMessage < ApplicationRecord
#课程动态公共表记录
def act_as_course_activity
self.course_act << CourseActivity.new(user_id: course_message_id, course_id: course_id)
CourseActivity.create(user_id: course_message_id, course_id: course_id, course_act: self)
end
def send_deal_tiding deal_status

@ -12,4 +12,13 @@ class CourseSecondCategory < ApplicationRecord
category_type == "graduation" && name == "毕设任务" ? "graduation_tasks" : category_type
)
end
def homework_publish_count
homework_commons.select{|homework| homework.publish_time.present? && homework.publish_time <= Time.now}.size
end
def homework_unpublish_count
homework_commons.select{|homework| homework.publish_time.nil? || homework.publish_time > Time.now}.size
end
end

@ -5,4 +5,7 @@ end
json.homework_category homework_category do |category|
json.category_id category.id
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

@ -45,7 +45,7 @@ namespace :homework_publishtime do
end
end
homework.course_act << CourseActivity.new(user_id: homework.user_id, course_id: homework.course_id) if !homework.course_act.present?
CourseActivity.create(user_id: homework.user_id, course_id: homework.course_id, course_act: homework) if !homework.course_act.present?
end
# 分组设置发布时间的作业

Loading…
Cancel
Save