Skip to content

Commit

Permalink
Convert to bytes beforehand (#857)
Browse files Browse the repository at this point in the history
  • Loading branch information
lancepioch authored Jan 4, 2025
1 parent 7a5dd87 commit 23d515c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/Models/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 23d515c

Please sign in to comment.