|
|
@ -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,
|
|
|
|
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,
|
|
|
|
: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,
|
|
|
|
: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]
|
|
|
|
# before_filter :member_of_course, :only => [:index,:setting]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -282,6 +282,7 @@ class HomeworkCommonController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def homework_setting
|
|
|
|
def homework_setting
|
|
|
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
if @homework.homework_detail_manual.try(:comment_status) == 0 && @course.course_groups.count > 1
|
|
|
|
if @homework.homework_detail_manual.try(:comment_status) == 0 && @course.course_groups.count > 1
|
|
|
|
@homework.unified_setting = params[:unified_setting] ? true :false
|
|
|
|
@homework.unified_setting = params[:unified_setting] ? true :false
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -585,6 +586,7 @@ class HomeworkCommonController < ApplicationController
|
|
|
|
create_works_tiding @homework, @course.student
|
|
|
|
create_works_tiding @homework, @course.student
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
redirect_to student_work_index_path(:homework => @homework.id)
|
|
|
|
redirect_to student_work_index_path(:homework => @homework.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -929,6 +931,7 @@ class HomeworkCommonController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def publish_homework
|
|
|
|
def publish_homework
|
|
|
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
if @homework.homework_detail_manual.try(:comment_status) == 0
|
|
|
|
if @homework.homework_detail_manual.try(:comment_status) == 0
|
|
|
|
if params[:group_ids]
|
|
|
|
if params[:group_ids]
|
|
|
|
if @course.course_groups.where(:id => params[:group_ids].split(",")).count == @course.course_groups.count
|
|
|
|
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
|
|
|
|
if @homework.end_time > Time.now && @homework.homework_detail_manual.try(:comment_status) > 1
|
|
|
|
@homework.homework_detail_manual.update_attribute("comment_status", 1)
|
|
|
|
@homework.homework_detail_manual.update_attribute("comment_status", 1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
redirect_to student_work_index_path(:homework => @homework.id)
|
|
|
|
redirect_to student_work_index_path(:homework => @homework.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -1032,6 +1036,7 @@ class HomeworkCommonController < ApplicationController
|
|
|
|
def end_homework
|
|
|
|
def end_homework
|
|
|
|
time = Time.now
|
|
|
|
time = Time.now
|
|
|
|
student_works = @homework.student_works.where("0=1")
|
|
|
|
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 @homework.homework_detail_manual.try(:comment_status) == 1 && @homework.end_time > time
|
|
|
|
if params[:group_ids]
|
|
|
|
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)
|
|
|
|
# @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
|
|
|
|
update_student_eff_score HomeworkCommon.where(:id => @homework.id).first
|
|
|
|
end
|
|
|
|
end
|
|
|
|
# end
|
|
|
|
# end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
redirect_to student_work_index_path(:homework => @homework.id)
|
|
|
|
redirect_to student_work_index_path(:homework => @homework.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|