|
|
@ -11,7 +11,7 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
before_action :find_homework, only: [:edit, :show, :update, :group_list, :homework_code_repeat, :code_review_results,
|
|
|
|
before_action :find_homework, only: [:edit, :show, :update, :group_list, :homework_code_repeat, :code_review_results,
|
|
|
|
:code_review_detail, :show_comment, :settings, :works_list, :update_settings,
|
|
|
|
:code_review_detail, :show_comment, :settings, :works_list, :update_settings,
|
|
|
|
:reference_answer, :publish_groups, :end_groups, :alter_name, :update_explanation,
|
|
|
|
:reference_answer, :publish_groups, :end_groups, :alter_name, :update_explanation,
|
|
|
|
:update_score, :update_student_score, :batch_comment]
|
|
|
|
:update_score, :update_student_score, :batch_comment, :get_next_work]
|
|
|
|
before_action :user_course_identity
|
|
|
|
before_action :user_course_identity
|
|
|
|
before_action :homework_publish, only: [:show, :works_list, :code_review_results, :show_comment, :settings, :reference_answer,
|
|
|
|
before_action :homework_publish, only: [:show, :works_list, :code_review_results, :show_comment, :settings, :reference_answer,
|
|
|
|
:update_student_score]
|
|
|
|
:update_student_score]
|
|
|
@ -287,6 +287,15 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_next_work
|
|
|
|
|
|
|
|
member = @course.course_member(current_user.id)
|
|
|
|
|
|
|
|
student_works = @homework.teacher_works(member).where.not(id: @homework.student_works_scores.where(reviewer_role: [1, 2]))
|
|
|
|
|
|
|
|
if params[:work_id]
|
|
|
|
|
|
|
|
student_works = student_works.where.not(id: params[:work_id])
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
@work = student_works.where("work_status > 0").take
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def update_score
|
|
|
|
def update_score
|
|
|
|
tip_exception("作业还未发布,暂不能计算成绩") if @homework.publish_time.nil? || @homework.publish_time > Time.now
|
|
|
|
tip_exception("作业还未发布,暂不能计算成绩") if @homework.publish_time.nil? || @homework.publish_time > Time.now
|
|
|
|
@homework.update_homework_work_score
|
|
|
|
@homework.update_homework_work_score
|
|
|
|