Skip to content

Commit

Permalink
Convert KiB to MiB
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <chrng8@gmail.com>
  • Loading branch information
Pytal committed Jun 6, 2022
1 parent 582cb94 commit 48ae999
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ public function exportable(?array $migrators): DataResponse {

try {
$size = $this->migrationService->estimateExportSize($user, $migrators);
// Convert to MiB and round to one significant digit after the decimal point
$roundedSize = round($size / 1024, 1);
} catch (UserMigrationException $e) {
throw new OCSException($e->getMessage());
}
Expand All @@ -237,8 +239,8 @@ public function exportable(?array $migrators): DataResponse {
}

return new DataResponse([
'size' => round($size, -2),
'units' => 'KiB',
'size' => $roundedSize,
'units' => 'MiB',
'warning' => $warning ?? null,
], Http::STATUS_OK);
}
Expand Down

0 comments on commit 48ae999

Please sign in to comment.