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 %>