This commit is contained in:
Andrew Brown 2021-07-19 23:01:23 -07:00
parent 01d6ba2c5c
commit faf34ddc9e
2 changed files with 16 additions and 8 deletions

View File

@ -45,7 +45,7 @@ class GreenService < Service
end
def self.total_document_pages_equivalent
(Document.with_deleted.sum(:cached_word_count) / AVERAGE_WORDS_PER_PAGE.to_f).to_i
(Document.with_deleted.sum(:cached_word_count) / AVERAGE_WORDS_PER_PAGE.to_f).round
end
def self.total_timeline_pages_equivalent

View File

@ -64,7 +64,8 @@
</td>
<td>
<i class="material-icons left grey-text">copy_all</i>
<%= pluralize physical_page_equivalent, 'page' %>
<%= number_with_delimiter physical_page_equivalent %>
<%= 'page'.pluralize physical_page_equivalent %>
</td>
<td>
<i class="material-icons left green-text">park</i>
@ -77,13 +78,16 @@
<td>
<strong>
<i class="material-icons left grey-text">copy_all</i>
<%= pluralize total_pages_equivalent, 'page' %>
<%= number_with_delimiter total_pages_equivalent %>
<%= 'page'.pluralize total_pages_equivalent %>
</strong>
</td>
<td>
<strong>
<i class="material-icons left green-text">park</i>
<%= pluralize total_pages_equivalent.to_f / GreenService::SHEETS_OF_PAPER_PER_TREE.round(5), 'tree' %>
<% trees_saved = total_pages_equivalent.to_f / GreenService::SHEETS_OF_PAPER_PER_TREE %>
<%= number_with_delimiter trees_saved.round(5) %>
<%= 'tree'.pluralize trees_saved %>
saved
</strong>
</td>
@ -140,15 +144,18 @@
<i class="material-icons left <%= content_class_from_name(content_type).color %>-text">
<%= content_class_from_name(content_type).icon %>
</i>
<%= pluralize content_list_count, content_type.pluralize %>
<%= number_with_delimiter content_list_count %>
<%= content_type.pluralize content_list_count %>
</td>
<td>
<i class="material-icons left grey-text">copy_all</i>
<%= pluralize physical_page_equivalent, 'page' %>
<%= number_with_delimiter physical_page_equivalent %>
<%= 'page'.pluralize physical_page_equivalent %>
</td>
<td>
<i class="material-icons left green-text">park</i>
<%= pluralize tree_equivalent.round(5), 'tree' %>
<%= number_with_delimiter tree_equivalent.round(5) %>
<%= 'tree'.pluralize tree_equivalent %>
</td>
</tr>
<% end %>
@ -157,7 +164,8 @@
<td>
<strong>
<i class="material-icons left grey-text">copy_all</i>
<%= pluralize total_pages_equivalent, 'page' %>
<%= number_with_delimiter total_pages_equivalent %>
<%= 'page'.pluralize total_pages_equivalent %>
</strong>
</td>
<td>