主题帖子数量不算在回复数之中
This commit is contained in:
parent
8f707f3987
commit
cc9dca4012
|
@ -25,7 +25,7 @@ class Forum < ActiveRecord::Base
|
|||
def self.reset_counters!(forum_id)
|
||||
forum_id = forum_id.to_i
|
||||
update_all("topic_count = (SELECT COUNT(*) FROM #{Memo.table_name} WHERE forum_id=#{forum_id} AND parent_id IS NULL)," +
|
||||
" memo_count = (SELECT COUNT(*) FROM #{Memo.table_name} WHERE forum_id=#{forum_id})," +
|
||||
" memo_count = (SELECT COUNT(*) FROM #{Memo.table_name} WHERE forum_id=#{forum_id} AND parent_id IS NOT NULL)," +
|
||||
" last_memo_id = (SELECT MAX(id) FROM #{Memo.table_name} WHERE forum_id=#{forum_id})",
|
||||
["id = ?", forum_id])
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue