|
|
@ -644,12 +644,7 @@ class Attachment < ActiveRecord::Base
|
|
|
|
def decrease_attchments_count
|
|
|
|
def decrease_attchments_count
|
|
|
|
if self.container_type == "Project" && !self.project.project_score.nil?
|
|
|
|
if self.container_type == "Project" && !self.project.project_score.nil?
|
|
|
|
attach_count = self.container.project_score.attach_num - 1
|
|
|
|
attach_count = self.container.project_score.attach_num - 1
|
|
|
|
if attach_count < 0
|
|
|
|
self.container.project_score.update_attribute(:attach_num, attach_count < 0 ? 0 : attach_count)
|
|
|
|
self.container.project_score.update_attribute(:attach_num, 0)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
self.container.project_score.update_attribute(:attach_num, attach_count)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|