Merge branch 'szzh' of https://git.trustie.net/jacknudt/trustieforge into szzh
This commit is contained in:
commit
7b4b575240
|
@ -90,7 +90,7 @@ class Attachment < ActiveRecord::Base
|
|||
before_save :files_to_final_location,:act_as_course_activity
|
||||
after_create :office_conver, :be_user_score,:act_as_forge_activity,:create_attachment_ealasticsearch_index
|
||||
after_update :office_conver, :be_user_score,:update_attachment_ealasticsearch_index
|
||||
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index#, :decrease_attchments_count
|
||||
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index, :decrease_attchments_count
|
||||
|
||||
# add by nwb
|
||||
# 获取所有可公开的资源文件列表
|
||||
|
@ -641,12 +641,12 @@ class Attachment < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# def decrease_attchments_count
|
||||
# if self.container_type == "Project"
|
||||
# count = self.container.attachments_count
|
||||
# #self.container.update_attribute(:attachments_count, self.container.attachments_count - 1)
|
||||
# end
|
||||
# end
|
||||
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)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Delete the previous articles index in Elasticsearch
|
||||
|
|
|
@ -219,15 +219,15 @@ class Journal < ActiveRecord::Base
|
|||
def decrease_issues_journal_count
|
||||
unless self.issue.project.nil?
|
||||
project = self.issue.project
|
||||
project.update_attribute(:journals_count, project.journals_count - 1)
|
||||
project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num - 1)
|
||||
end
|
||||
end
|
||||
|
||||
# issue留言总数更新
|
||||
def add_journals_count
|
||||
if !self.issue.project.nil? && self.journalized_type == "Issue" && self.issue.project.project_score.nil?
|
||||
if !self.issue.project.nil? && self.journalized_type == "Issue" && !self.issue.project.project_score.nil?
|
||||
project = self.issue.project
|
||||
project.project_score.update_attribute(:issue_journal_num, project.project_score.journals_count + 1)
|
||||
project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -128,8 +128,7 @@ class Message < ActiveRecord::Base
|
|||
|
||||
# 发帖精辟更新发帖总数
|
||||
def add_boards_count
|
||||
unless self.project.project_score.nil?
|
||||
if self.project
|
||||
if self.project && !project.project_score.nil?
|
||||
# 讨论区
|
||||
if self.parent_id.nil?
|
||||
count = self.project.project_score.board_num + 1
|
||||
|
@ -140,12 +139,10 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 删除帖子的时候更新帖子总数, 删除回复的时候总数不减少
|
||||
def decrease_boards_count
|
||||
unless self.project.project_score.nil?
|
||||
if self.project && self.parent_id.nil?
|
||||
if self.project && !project.project_score.nil?
|
||||
# 讨论区
|
||||
if self.parent_id.nil?
|
||||
count = self.project.project_score.board_num - 1
|
||||
|
@ -156,7 +153,6 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def reset_counters!
|
||||
if parent && parent.id
|
||||
|
|
Loading…
Reference in New Issue