优化留言速度

This commit is contained in:
yuanke 2016-11-04 11:30:11 +08:00
parent 7064e5b413
commit fc19a468b7
2 changed files with 8 additions and 15 deletions

View File

@ -162,7 +162,7 @@ class JournalsForMessage < ActiveRecord::Base
end
def reset_counters!
self.class.reset_counters!(self)
# self.class.reset_counters!(self)
end
def self.reset_counters! journals_for_messages
# jfm_id = journals_for_messages.id.to_i

View File

@ -68,20 +68,13 @@
<% end %>
</td>
<td class="center">
<% if(journal.m_reply_count) %>
<% replys = JournalsForMessage.where(:m_parent_id=>journal.id) %>
<% reply_count = replys.nil? ? 0:replys.count %>
<%case journal.jour_type %>
<% when 'Principal' %>
<%= link_to(journal.m_reply_count, feedback_path(journal.jour_id)) %>
<%= link_to(reply_count, feedback_path(journal.jour_id)) %>
<% when 'Course' %>
<%= link_to(journal.m_reply_count, course_feedback_path(journal.jour_id)) %>
<% end %>
<% else %>
<%case journal.jour_type %>
<% when 'Principal' %>
<%= link_to(0, feedback_path(journal.jour_id)) %>
<% when 'Course' %>
<%= link_to(0, course_feedback_path(journal.jour_id)) %>
<% end %>
<%= link_to(reply_count, course_feedback_path(journal.jour_id)) %>
<% end %>
</td>
</tr>