帖子列表的回复数与实际不符
This commit is contained in:
parent
599cedaa18
commit
0dd7ef4460
|
@ -125,7 +125,9 @@ class BoardsController < ApplicationController
|
|||
if @order.to_i == 2
|
||||
@type = 2
|
||||
@topics.each do |topic|
|
||||
topic[:infocount] = get_praise_num(topic) + (topic.parent ? topic.parent.children.count : topic.children.count)
|
||||
all_comments = []
|
||||
count=get_all_children(all_comments, topic).count
|
||||
topic[:infocount] = get_praise_num(topic) + count
|
||||
if topic[:infocount] < 0
|
||||
topic[:infocount] = 0
|
||||
end
|
||||
|
|
|
@ -46,12 +46,8 @@
|
|||
发帖人: <%=(u.try(:realname) != " " ? u.lastname + u.firstname : u.try(:login)) %>
|
||||
</span>
|
||||
<span class="grayTxt">更新:<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %></span>
|
||||
<% count=0 %>
|
||||
<% if activity.parent %>
|
||||
<% count=activity.parent.children.count%>
|
||||
<% else %>
|
||||
<% count=activity.children.count%>
|
||||
<% end %>
|
||||
<% all_comments = []%>
|
||||
<% count=get_all_children(all_comments, activity).count %>
|
||||
<p class="list-info fr grayTxt"><span><%= count>0 ? "#{count}" : "0" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %></span><span>赞</span></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -46,12 +46,8 @@
|
|||
发帖人:<%=(u.try(:realname) != " " ? u.lastname + u.firstname : u.try(:login)) %>
|
||||
</span>
|
||||
<span class="grayTxt">更新:<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %></span>
|
||||
<% count=0 %>
|
||||
<% if activity.parent %>
|
||||
<% count=activity.parent.children.count%>
|
||||
<% else %>
|
||||
<% count=activity.children.count%>
|
||||
<% end %>
|
||||
<% all_comments = []%>
|
||||
<% count=get_all_children(all_comments, activity).count %>
|
||||
<p class="list-info fr grayTxt"><span><%= count>0 ? "#{count}" : "0" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %></span><span>赞</span></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
Loading…
Reference in New Issue