dev_haigong
cxt 6 years ago
parent e836d333ea
commit d0178f1a9f

@ -16,7 +16,7 @@ class HomeworkCommonController < ApplicationController
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,
:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,
:open_student_works,:add_to_homework_bank,:publish_notice,:end_notice,:publish_homework,:end_homework,:update_explanation,
:cancel_publish, :move_to_category]
:cancel_publish, :move_to_category,:homework_setting]
# before_filter :member_of_course, :only => [:index,:setting]
@ -282,6 +282,7 @@ class HomeworkCommonController < ApplicationController
end
def homework_setting
ActiveRecord::Base.transaction do
if @homework.homework_detail_manual.try(:comment_status) == 0 && @course.course_groups.count > 1
@homework.unified_setting = params[:unified_setting] ? true :false
end
@ -585,6 +586,7 @@ class HomeworkCommonController < ApplicationController
create_works_tiding @homework, @course.student
end
end
end
redirect_to student_work_index_path(:homework => @homework.id)
end
@ -929,6 +931,7 @@ class HomeworkCommonController < ApplicationController
end
def publish_homework
ActiveRecord::Base.transaction do
if @homework.homework_detail_manual.try(:comment_status) == 0
if params[:group_ids]
if @course.course_groups.where(:id => params[:group_ids].split(",")).count == @course.course_groups.count
@ -984,6 +987,7 @@ class HomeworkCommonController < ApplicationController
if @homework.end_time > Time.now && @homework.homework_detail_manual.try(:comment_status) > 1
@homework.homework_detail_manual.update_attribute("comment_status", 1)
end
end
redirect_to student_work_index_path(:homework => @homework.id)
end
@ -1032,6 +1036,7 @@ class HomeworkCommonController < ApplicationController
def end_homework
time = Time.now
student_works = @homework.student_works.where("0=1")
ActiveRecord::Base.transaction do
# if @homework.homework_detail_manual.try(:comment_status) == 1 && @homework.end_time > time
if params[:group_ids]
# @homework.homework_group_settings.where(:course_group_id => params[:group_id]).where("publish_time > '#{Time.now}' or publish_time is null").update_all(:publish_time => time)
@ -1070,6 +1075,8 @@ class HomeworkCommonController < ApplicationController
update_student_eff_score HomeworkCommon.where(:id => @homework.id).first
end
# end
end
redirect_to student_work_index_path(:homework => @homework.id)
end

Loading…
Cancel
Save