From fc19a468b790cfeb15ba3a348a9071bd479cf86c Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 4 Nov 2016 11:30:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=95=99=E8=A8=80=E9=80=9F?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/journals_for_message.rb | 2 +- app/views/admin/leave_messages.html.erb | 21 +++++++-------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 2ea52fd92..2a432d42f 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -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 diff --git a/app/views/admin/leave_messages.html.erb b/app/views/admin/leave_messages.html.erb index a9acba903..f2d0a7dd9 100644 --- a/app/views/admin/leave_messages.html.erb +++ b/app/views/admin/leave_messages.html.erb @@ -68,20 +68,13 @@ <% end %> - <% if(journal.m_reply_count) %> - <%case journal.jour_type %> - <% when 'Principal' %> - <%= link_to(journal.m_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 %> + <% replys = JournalsForMessage.where(:m_parent_id=>journal.id) %> + <% reply_count = replys.nil? ? 0:replys.count %> + <%case journal.jour_type %> + <% when 'Principal' %> + <%= link_to(reply_count, feedback_path(journal.jour_id)) %> + <% when 'Course' %> + <%= link_to(reply_count, course_feedback_path(journal.jour_id)) %> <% end %>