From e24c569953ccffb556761a21c0e01fae43db1424 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Fri, 3 Jan 2025 17:07:54 -0500 Subject: [PATCH] Convert to bytes beforehand --- app/Models/Server.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Models/Server.php b/app/Models/Server.php index 62dfe09454..5c58f48ca2 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -473,6 +473,11 @@ public function formatResource(string $resourceKey, bool $limit = false, ServerR return Number::format($resourceAmount, precision: $precision, locale: auth()->user()->language ?? 'en') . '%'; } + // Our current limits are set in MB + if ($limit) { + $resourceAmount *= 2 ** 20; + } + return convert_bytes_to_readable($resourceAmount, decimals: $precision, base: 3); }