ecloud_sso
cxt 5 years ago
commit 4dd52735d7

@ -257,10 +257,10 @@ class Course < ApplicationRecord
# 老师负责的分班id # 老师负责的分班id
def charge_group_ids user def charge_group_ids user
member = user.is_a?(CourseMember) ? user : course_member(user.id) member = user.is_a?(CourseMember) ? user : course_member(user&.id)
group_ids = if member.present? group_ids = if member.present?
member.teacher_course_groups.size > 0 ? member.teacher_course_groups.pluck(:course_group_id) : course_groups.pluck(:id) member.teacher_course_groups.size > 0 ? member.teacher_course_groups.pluck(:course_group_id) : course_groups.pluck(:id)
elsif user.admin_or_business? elsif user&.admin_or_business?
course_groups.pluck(:id) course_groups.pluck(:id)
else else
[] []

@ -24,9 +24,9 @@ json.homeworks @homework_commons.each do |homework|
# 只有在主目录才显示 # 只有在主目录才显示
json.upper_category_name homework.course_second_category&.name unless params[:category] json.upper_category_name homework.course_second_category&.name unless params[:category]
# charge_ids = @course.charge_group_ids(@member) charge_ids = @course.charge_group_ids(@member)
# json.publish_immediately @user_course_identity < Course::STUDENT && homework.publish_immediately(charge_ids) json.publish_immediately @user.logged? && @user_course_identity < Course::STUDENT && homework.publish_immediately(charge_ids)
# json.end_immediately @user_course_identity < Course::STUDENT && homework.end_immediately(charge_ids) json.end_immediately @user.logged? && @user_course_identity < Course::STUDENT && homework.end_immediately(charge_ids)
unless curr_status[:status].include?("未发布") unless curr_status[:status].include?("未发布")
work_count = calculate_work_count homework, @member work_count = calculate_work_count homework, @member

Loading…
Cancel
Save