Merge pull request #128 from medialab-prado/comments-count
Add draft versions comments count to admin views
This commit is contained in:
@@ -26,4 +26,8 @@ class Legislation::DraftVersion < ActiveRecord::Base
|
||||
def display_title
|
||||
status == 'draft' ? "#{title} *" : title
|
||||
end
|
||||
|
||||
def total_comments
|
||||
annotations.sum(:comments_count)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -64,7 +64,7 @@ class Legislation::Process < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def total_comments
|
||||
questions.sum(:comments_count)
|
||||
questions.sum(:comments_count) + draft_versions.map(&:total_comments).sum
|
||||
end
|
||||
|
||||
def status
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</td>
|
||||
<td><%= draft_version.created_at.to_date %></td>
|
||||
<td><%= draft_version.status %> <%= link_to "(#{t('.preview')})", legislation_process_draft_version_path(@process, draft_version) if draft_version.status == 'draft' %></td>
|
||||
<td><%#= draft_version.comments %></td>
|
||||
<td><%= draft_version.total_comments %></td>
|
||||
<td><%= draft_version.final_version %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user