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