diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 7b510ec91..1d8fd7466 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -206,7 +206,7 @@ class HomeworkCommonController < ApplicationController student_work_projects = @homework.student_work_projects.where("student_work_id is not null") student_work_projects.each_with_index do |pro_work, pro_index| n = @homework_detail_manual.evaluation_num - n = n < student_works.size ? n : student_works.size - 1 + n = (n < student_works.size && n != -1) ? n : student_works.size - 1 work_index = -1 student_works.each_with_index do |stu_work, stu_index| if stu_work.id.to_i == pro_work.student_work_id.to_i @@ -223,7 +223,7 @@ class HomeworkCommonController < ApplicationController student_works.each_with_index do |work, index| user = work.user n = @homework_detail_manual.evaluation_num - n = n < student_works.size ? n : student_works.size - 1 + n = (n < student_works.size && n != -1) ? n : student_works.size - 1 assigned_homeworks = get_assigned_homeworks(student_works, n, index) assigned_homeworks.each do |h| student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6a1c00ae6..933748ea0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2854,7 +2854,7 @@ module ApplicationHelper link_to "补交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_red' end else - if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 && work.user_id == User.current.id #匿评作业,且作业状态不是在开启匿评之前 + if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 #匿评作业,且作业状态不是在开启匿评之前 link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "开启匿评后不可修改作品" elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "匿评已结束" diff --git a/lib/tasks/homework_evaluation.rake b/lib/tasks/homework_evaluation.rake index e53e974ff..087c6183c 100644 --- a/lib/tasks/homework_evaluation.rake +++ b/lib/tasks/homework_evaluation.rake @@ -20,7 +20,7 @@ namespace :homework_evaluation do student_work_projects = homework_common.student_work_projects.where("student_work_id is not null") student_work_projects.each_with_index do |pro_work, pro_index| n = homework_detail_manual.evaluation_num - n = n < student_works.size ? n : student_works.size - 1 + n = (n < student_works.size && n != -1) ? n : student_works.size - 1 work_index = -1 student_works.each_with_index do |stu_work, stu_index| if stu_work.id.to_i == pro_work.student_work_id.to_i @@ -37,7 +37,7 @@ namespace :homework_evaluation do student_works.each_with_index do |work, index| user = work.user n = homework_detail_manual.evaluation_num - n = n < student_works.size ? n : student_works.size - 1 + n = (n < student_works.size && n != -1) ? n : student_works.size - 1 assigned_homeworks = get_assigned_homeworks(student_works, n, index) assigned_homeworks.each do |h| student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)