项目新闻、项目讨论区区分project和course
This commit is contained in:
parent
64088f5a21
commit
5519ef78e2
|
@ -127,7 +127,7 @@ class Message < ActiveRecord::Base
|
||||||
|
|
||||||
# 发帖精辟更新发帖总数
|
# 发帖精辟更新发帖总数
|
||||||
def add_boards_count
|
def add_boards_count
|
||||||
if self.parent_id.nil?
|
if self.project && self.parent_id.nil?
|
||||||
count = self.project.boards_count + 1
|
count = self.project.boards_count + 1
|
||||||
self.project.update_attribute(:boards_count, count)
|
self.project.update_attribute(:boards_count, count)
|
||||||
end
|
end
|
||||||
|
@ -313,7 +313,7 @@ class Message < ActiveRecord::Base
|
||||||
|
|
||||||
# 删除帖子的时候更新帖子总数, 删除回复的时候总数不减少
|
# 删除帖子的时候更新帖子总数, 删除回复的时候总数不减少
|
||||||
def decrease_boards_count
|
def decrease_boards_count
|
||||||
if self.parent_id.nil?
|
if self.project && self.parent_id.nil?
|
||||||
count = self.project.boards_count - 1
|
count = self.project.boards_count - 1
|
||||||
self.project.update_attribute(:boards_count, count)
|
self.project.update_attribute(:boards_count, count)
|
||||||
end
|
end
|
||||||
|
|
|
@ -169,8 +169,10 @@ class News < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def decrease_news_count
|
def decrease_news_count
|
||||||
count = self.project.news_count - 1
|
if self.project
|
||||||
self.project.update_attribute(:news_count, count)
|
count = self.project.news_count - 1
|
||||||
|
self.project.update_attribute(:news_count, count)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_mail
|
def send_mail
|
||||||
|
|
Loading…
Reference in New Issue