资源设置

dev_forge
cxt 5 years ago
parent 02655789e1
commit f2e29cd33d

@ -181,8 +181,8 @@ class FilesController < ApplicationController
attachment.delay_publish = @atta_delay_publish
attachment.publish_time = @atta_publish_time
attachment.unified_setting = @unified_setting
unless @unified_setting
if @unified_setting == 0
attachment_group_setting attachment, params[:group_settings]
end
# attachment.set_publish_time(publish_time) if is_unified_setting
# attachment.set_course_group_publish_time(@course, course_group_publish_times) if @course.course_groups.size > 0 && !is_unified_setting && publish_time.blank?
@ -226,6 +226,10 @@ class FilesController < ApplicationController
attach_copied_obj.is_publish = @atta_is_publish
attach_copied_obj.delay_publish = @atta_delay_publish
attach_copied_obj.publish_time = @atta_publish_time
attach_copied_obj.unified_setting = @unified_setting
if @unified_setting == 0
attachment_group_setting attach_copied_obj, params[:group_settings]
end
attach_copied_obj.course_second_category_id = course_second_category_id
attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from
if attach_copied_obj.attachtype == nil
@ -265,6 +269,10 @@ class FilesController < ApplicationController
@old_attachment.is_publish = @atta_is_publish
@old_attachment.delay_publish = @atta_delay_publish
@old_attachment.publish_time = @atta_publish_time
@old_attachment.unified_setting = @unified_setting
if @unified_setting == 0
attachment_group_setting @old_attachment, params[:group_settings]
end
if params[:description] && !params[:description].strip.blank? && params[:description] != @old_attachment.description
@old_attachment.description = params[:description]
@ -376,4 +384,14 @@ class FilesController < ApplicationController
end
end
end
def attachment_group_setting attachment, group_setting
create_atta_group_settings attachment
group_setting.each do |setting|
tip_exception("分班id不能为空") if setting[:group_id].length == 0
tip_exception("发布时间不能为空") if setting[:publish_time].blank?
AttachmentGroupSetting.where(attachment_id: attachment.id, course_group_id: setting[:group_id]).
update_all(publish_time: setting[:publish_time])
end
end
end

@ -13,7 +13,8 @@ class HomeworkCommonsController < ApplicationController
:reference_answer, :publish_groups, :end_groups, :alter_name, :update_explanation,
:update_score, :update_student_score]
before_action :user_course_identity
before_action :homework_publish, only: [:show, :works_list, :code_review_results, :show_comment, :settings, :reference_answer, :update_student_score]
before_action :homework_publish, only: [:show, :works_list, :code_review_results, :show_comment, :settings, :reference_answer,
:update_student_score]
before_action :teacher_allowed, only: [:new, :edit, :create, :update, :shixuns, :subjects, :create_shixun_homework,
:publish_homework, :end_homework, :set_public, :choose_category, :move_to_category,
:choose_category, :create_subject_homework, :multi_destroy, :group_list, :homework_code_repeat,

Loading…
Cancel
Save