From 8ca9339d2418cb11ca0013328761c100128c39a5 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 11 Jan 2020 15:34:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 8 ++++---- app/controllers/poll_votes_controller.rb | 2 +- app/controllers/student_works_controller.rb | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index f67e7d543..f386ad1b2 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -976,7 +976,7 @@ class HomeworkCommonsController < ApplicationController elsif homework.max_group_end_time homework.end_time = homework.max_group_end_time end - homework.homework_detail_manual.update_attribute('comment_status', 1) + homework.homework_detail_manual.update_attributes!(comment_status: 1) if homework.course_acts.size == 0 homework.course_acts << CourseActivity.new(user_id: homework.user_id, course_id: homework.course_id) @@ -1004,7 +1004,7 @@ class HomeworkCommonsController < ApplicationController 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_attributes!(comment_status: 1) end # 补交结束时间 @@ -1071,7 +1071,7 @@ class HomeworkCommonsController < ApplicationController homework.end_time = homework.max_group_end_time if homework.end_time > time && homework_detail_manual.try(:comment_status) > 1 - homework_detail_manual.update_attribute("comment_status", 1) + homework_detail_manual.update_attributes!(comment_status: 1) end # 统一设置 @@ -1080,7 +1080,7 @@ class HomeworkCommonsController < ApplicationController homework.end_time = time end - homework_detail_manual.update_attribute("comment_status", 2) if homework.end_time <= time + homework_detail_manual.update_attributes!(comment_status: 2) if homework.end_time <= time # 实训作业的作品需要计算是否迟交 if homework.homework_type == "practice" diff --git a/app/controllers/poll_votes_controller.rb b/app/controllers/poll_votes_controller.rb index 6e4a9b470..72207f488 100644 --- a/app/controllers/poll_votes_controller.rb +++ b/app/controllers/poll_votes_controller.rb @@ -48,7 +48,7 @@ class PollVotesController < ApplicationController ques_vote_id = question_answer_ids.map(&:to_i).max ques_vote = user_votes.find_by(poll_answer_id: ques_vote_id) if ques_vote.present? - ques_vote.update_attribute!("vote_text", question_answer_text) + ques_vote.update_attributes!(vote_text: question_answer_text) else answer_option = { :user_id => current_user.id, diff --git a/app/controllers/student_works_controller.rb b/app/controllers/student_works_controller.rb index 98bb6a999..80d8738a9 100644 --- a/app/controllers/student_works_controller.rb +++ b/app/controllers/student_works_controller.rb @@ -681,7 +681,7 @@ class StudentWorksController < ApplicationController # 申诉成功后 扣匿评学生的违规匿评扣分 sw = @homework.student_works.find_by(user_id: score.user_id) - sw.update_attribute!("appeal_penalty", @homework.homework_detail_manual.appeal_penalty + sw.appeal_penalty) if sw.present? + sw.update_attributes!(appeal_penalty: @homework.homework_detail_manual.appeal_penalty + sw.appeal_penalty) if sw.present? # 申诉成功 重新计算申诉者的匿评分 if @work.student_works_scores.where("reviewer_role = 3 AND appeal_status != 3").count > 0