From faf34ddc9e4103ceed7044a5b66c8da7aff9273a Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 19 Jul 2021 23:01:23 -0700 Subject: [PATCH] commas --- app/services/green_service.rb | 2 +- app/views/data/green.html.erb | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/services/green_service.rb b/app/services/green_service.rb index 73440ba9..d42b52fe 100644 --- a/app/services/green_service.rb +++ b/app/services/green_service.rb @@ -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 diff --git a/app/views/data/green.html.erb b/app/views/data/green.html.erb index 4169a552..0f9d6da3 100644 --- a/app/views/data/green.html.erb +++ b/app/views/data/green.html.erb @@ -64,7 +64,8 @@ copy_all - <%= pluralize physical_page_equivalent, 'page' %> + <%= number_with_delimiter physical_page_equivalent %> + <%= 'page'.pluralize physical_page_equivalent %> park @@ -77,13 +78,16 @@ copy_all - <%= pluralize total_pages_equivalent, 'page' %> + <%= number_with_delimiter total_pages_equivalent %> + <%= 'page'.pluralize total_pages_equivalent %> park - <%= 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 @@ -140,15 +144,18 @@ <%= content_class_from_name(content_type).icon %> - <%= pluralize content_list_count, content_type.pluralize %> + <%= number_with_delimiter content_list_count %> + <%= content_type.pluralize content_list_count %> copy_all - <%= pluralize physical_page_equivalent, 'page' %> + <%= number_with_delimiter physical_page_equivalent %> + <%= 'page'.pluralize physical_page_equivalent %> park - <%= pluralize tree_equivalent.round(5), 'tree' %> + <%= number_with_delimiter tree_equivalent.round(5) %> + <%= 'tree'.pluralize tree_equivalent %> <% end %> @@ -157,7 +164,8 @@ copy_all - <%= pluralize total_pages_equivalent, 'page' %> + <%= number_with_delimiter total_pages_equivalent %> + <%= 'page'.pluralize total_pages_equivalent %>