From 8b7ba5c765266cbe8f9243eafb35530eef200897 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 6 Jul 2019 16:53:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E5=88=86=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_works_controller.rb | 2 +- app/services/homeworks_service.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/student_works_controller.rb b/app/controllers/student_works_controller.rb index 7c7201d32..309c8b379 100644 --- a/app/controllers/student_works_controller.rb +++ b/app/controllers/student_works_controller.rb @@ -335,6 +335,7 @@ class StudentWorksController < ApplicationController begin # 没传score则取上次评分成绩 new_score = StudentWorksScore.new + score = StudentWorksScore.where(user_id: current_user.id, student_work_id: @work.id, reviewer_role: reviewer_role).last new_score.score = params[:score].blank? ? score.try(:score) : params[:score].to_f new_score.comment = params[:comment] if params[:comment] && params[:comment].strip != "" new_score.user_id = current_user.id @@ -349,7 +350,6 @@ class StudentWorksController < ApplicationController reviewer_role = @user_course_identity == Course::STUDENT ? 3 : @user_course_identity == Course::ASSISTANT_PROFESSOR ? 2 : 1 new_score.reviewer_role = reviewer_role - score = StudentWorksScore.where(user_id: current_user.id, student_work_id: @work.id, reviewer_role: reviewer_role).last if new_score.save! Attachment.associate_container(params[:attachment_ids], new_score.id, new_score.class) diff --git a/app/services/homeworks_service.rb b/app/services/homeworks_service.rb index 306a48d3c..4d16b5456 100644 --- a/app/services/homeworks_service.rb +++ b/app/services/homeworks_service.rb @@ -316,7 +316,7 @@ class HomeworksService if work.work_status == 0 is_complete = myshixun_endtime && (myshixun_endtime < setting_time.end_time) - if is_complete || (!homework.allow_late && myshixun.created_at < setting_time.end_time) + if is_complete || (myshixun.created_at < setting_time.end_time && (!homework.allow_late || setting_time.end_time <= Time.now)) work.work_status = 1 elsif homework.allow_late && myshixun.created_at < homework.late_time work.work_status = 2