diff --git a/app/models/storage.rb b/app/models/storage.rb index c75768bab78..953e8b51f87 100644 --- a/app/models/storage.rb +++ b/app/models/storage.rb @@ -581,12 +581,12 @@ def used_space alias_method :v_used_space, :used_space def used_space_percent_of_total - total_space.to_f == 0.0 ? 0.0 : (used_space.to_f / total_space.to_f * 1000.0).round / 10.0 + total_space.zero? ? 0.0 : (used_space.to_f / total_space * 1000.0).round / 10.0 end alias_method :v_used_space_percent_of_total, :used_space_percent_of_total def free_space_percent_of_total - total_space.to_f == 0.0 ? 0.0 : (free_space.to_f / total_space.to_f * 1000.0).round / 10.0 + total_space.zero? ? 0.0 : (free_space.to_f / total_space * 1000.0).round / 10.0 end alias_method :v_free_space_percent_of_total, :free_space_percent_of_total @@ -618,23 +618,23 @@ def v_total_vms alias_method :v_total_disk_size, :disk_size def v_debris_percent_of_used - used_space.to_f == 0.0 ? 0.0 : (debris_size.to_f / used_space.to_f * 1000.0).round / 10.0 + used_space.zero? ? 0.0 : (debris_size.to_f / used_space * 1000.0).round / 10.0 end def v_snapshot_percent_of_used - used_space.to_f == 0.0 ? 0.0 : (snapshot_size.to_f / used_space.to_f * 1000.0).round / 10.0 + used_space.zero? ? 0.0 : (snapshot_size.to_f / used_space * 1000.0).round / 10.0 end def v_memory_percent_of_used - used_space.to_f == 0.0 ? 0.0 : (vm_ram_size.to_f / used_space.to_f * 1000.0).round / 10.0 + used_space.zero? ? 0.0 : (vm_ram_size.to_f / used_space * 1000.0).round / 10.0 end def v_vm_misc_percent_of_used - used_space.to_f == 0.0 ? 0.0 : (vm_misc_size.to_f / used_space.to_f * 1000.0).round / 10.0 + used_space.zero? ? 0.0 : (vm_misc_size.to_f / used_space * 1000.0).round / 10.0 end def v_disk_percent_of_used - used_space.to_f == 0.0 ? 0.0 : (disk_size.to_f / used_space.to_f * 1000.0).round / 10.0 + used_space.zero? ? 0.0 : (disk_size.to_f / used_space * 1000.0).round / 10.0 end def v_total_provisioned @@ -642,7 +642,7 @@ def v_total_provisioned end def v_provisioned_percent_of_total - total_space.to_f == 0 ? 0.0 : (v_total_provisioned.to_f / total_space.to_f * 1000.0).round / 10.0 + total_space.zero? ? 0.0 : (v_total_provisioned.to_f / total_space * 1000.0).round / 10.0 end #