@ -48,7 +48,7 @@ class GraduationWork < ApplicationRecord
def delete_atta atta
last_score = graduation_work_scores.where.not(score: nil).last
atta.author_id == user_id && (!last_score.present? || last_score.try(:created_at) < atta.created_on)
(atta.author_id == self.user_id) && (last_score.blank? || last_score.try(:created_at) < atta.created_on)
end
# 分班名
@ -106,7 +106,7 @@ class StudentWork < ApplicationRecord
last_score = student_works_scores.where.not(score: nil).last
# 作品总体评价
@ -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: @work.delete_atta(atta)}
json.partial! "attachments/attachment_simple", locals: {attachment: atta, delete: false}
unless @is_evaluation