|
|
|
@ -87,16 +87,16 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
@task_count = @homework_commons.size
|
|
|
|
|
|
|
|
|
|
order_str = @homework_type == 4 ? "position DESC" : "IF(ISNULL(homework_commons.publish_time),0,1), homework_commons.publish_time DESC,
|
|
|
|
|
order_str = @homework_type == 4 ? "homework_commons.position DESC" : "IF(ISNULL(homework_commons.publish_time),0,1), homework_commons.publish_time DESC,
|
|
|
|
|
homework_commons.created_at DESC"
|
|
|
|
|
@homework_commons = @homework_commons.order(order_str).page(page).per(15)
|
|
|
|
|
|
|
|
|
|
if @homework_type == 4
|
|
|
|
|
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :shixuns)
|
|
|
|
|
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_group_settings, :shixuns, :course_second_category, user: :user_extension)
|
|
|
|
|
elsif @homework_type == 3
|
|
|
|
|
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_detail_group)
|
|
|
|
|
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_group_settings, :homework_detail_group, :course_second_category, user: :user_extension)
|
|
|
|
|
else
|
|
|
|
|
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings)
|
|
|
|
|
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_group_settings, :course_second_category, user: :user_extension)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -902,7 +902,8 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def publish_groups
|
|
|
|
|
@current_user = current_user
|
|
|
|
|
if @homework.publish_immediately @current_user
|
|
|
|
|
charge_ids = @course.charge_group_ids(@current_user)
|
|
|
|
|
if @homework.publish_immediately charge_ids
|
|
|
|
|
# 可立即发布的分班:当前用户管理的分班去除已发布的分班
|
|
|
|
|
group_ids = @course.charge_group_ids(@current_user) - @homework.homework_group_settings.group_published.pluck(:course_group_id)
|
|
|
|
|
@course_groups = @course.course_groups.where(id: group_ids)
|
|
|
|
@ -1031,7 +1032,8 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def end_groups
|
|
|
|
|
@current_user = current_user
|
|
|
|
|
if @homework.end_immediately @current_user
|
|
|
|
|
charge_ids = @course.charge_group_ids(@current_user)
|
|
|
|
|
if @homework.end_immediately charge_ids
|
|
|
|
|
# 可立即截止的分班:统一设置则是用户管理的所有分班,否则是当前用户管理的分班中已发布且未截止的
|
|
|
|
|
charge_group_ids = @course.charge_group_ids(@current_user) # 当前用户管理的分班
|
|
|
|
|
group_ids = @homework.unified_setting ? charge_group_ids :
|
|
|
|
@ -1313,7 +1315,7 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
# 最新一次的查重时间
|
|
|
|
|
@last_review_time = format_time @homework.homework_group_reviews.last.try(:created_at)
|
|
|
|
|
|
|
|
|
|
@charge_ids = @course.charge_group_ids(@current_user)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 代码查重代码的详情
|
|
|
|
|