From 54d98cf71a4a42a67056d89cfb2fa09808d0f735 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 9 Jan 2020 17:47:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=84=E9=98=85=E8=AE=B0=E5=BD=95=E7=9A=84?= =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/graduation_work.rb | 2 +- app/views/student_works/show.json.jbuilder | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/graduation_work.rb b/app/models/graduation_work.rb index 96dce0c49..7fb0ecc24 100644 --- a/app/models/graduation_work.rb +++ b/app/models/graduation_work.rb @@ -55,7 +55,7 @@ class GraduationWork < ApplicationRecord end def delete_atta atta - last_score = graduation_work_scores.where.not(score: nil).last + last_score = graduation_work_scores.last (atta.author_id == User.current.id) && (last_score.blank? || last_score.try(:created_at) < atta.created_on) end diff --git a/app/views/student_works/show.json.jbuilder b/app/views/student_works/show.json.jbuilder index 7b3a91b5e..8cb3ee7ca 100644 --- a/app/views/student_works/show.json.jbuilder +++ b/app/views/student_works/show.json.jbuilder @@ -11,7 +11,7 @@ json.update_user_name @is_evaluation ? "匿名" : @work.update_user.try(:real_na json.update_atta @homework.late_duration && @is_author json.attachments @attachments do |atta| - json.partial! "attachments/attachment_simple", locals: {attachment: atta, delete: false, } + json.partial! "attachments/attachment_simple", locals: {attachment: atta, delete: false } end unless @is_evaluation