diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..5fed47d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,11 @@ module ApplicationHelper + # Custom helper for better display of big numbers + # @example number_by_magnitude(4242) + # "4.2K" + # + # @param number[Numeric] + # @return [String] human friendly respresentation + def number_by_magnitude(number) + number_to_human(number, units: { thousand: :K, million: :M, billion: :G }) + end end diff --git a/app/views/clients/_client.html.erb b/app/views/clients/_client.html.erb index 2a21339..3f5a2eb 100644 --- a/app/views/clients/_client.html.erb +++ b/app/views/clients/_client.html.erb @@ -1,13 +1,11 @@ <%= link_to client.name, client %> <%= client.uname %> <%= @active_jobs[client.id] || 0 %> <%= client.last_job_date %> <%= client.file_retention_days %> <%= client.job_retention_days %> <%= number_to_human_size(client.backup_jobs_size) %> - - <%= number_to_human(client.files_count, units: { thousand: :K, million: :M, billion: :G }) %> - + <%= number_by_magnitude(client.files_count) %> <%= client.auto_prune_human %>