diff --git a/src/lib/helpers/sizeConvertion.ts b/src/lib/helpers/sizeConvertion.ts index 07d37022d..00709e4de 100644 --- a/src/lib/helpers/sizeConvertion.ts +++ b/src/lib/helpers/sizeConvertion.ts @@ -24,7 +24,7 @@ export function bytesToSize(value: number, unit: Size, base = 1000) { } export function mbSecondsToGBHours(value: number, base: 1000 | 1024 = 1000) { - return (value / base) / (60 * 60); + return value / base / (60 * 60); } export function humanFileSize( diff --git a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte index d6d3f95cf..4484601b2 100644 --- a/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/organization-[organization]/usage/[[invoice]]/+page.svelte @@ -380,7 +380,9 @@

{(Math.ceil(totalGbHours * 100) / 100).toLocaleString('en-US')} + >{(Math.ceil(totalGbHours * 100) / 100).toLocaleString( + 'en-US' + )} {`GB hours`}

diff --git a/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte b/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte index ed6a2bdfb..260a5cfe6 100644 --- a/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte +++ b/src/routes/(console)/project-[project]/settings/usage/[[invoice]]/+page.svelte @@ -333,56 +333,56 @@ GB hours represent the memory usage (in gigabytes) of your function executions and builds, multiplied by the total execution time (in hours).

- - {#if data.usage.executionsMbSecondsTotal} - {@const totalGbHours = mbSecondsToGBHours( - data.usage.executionsMbSecondsTotal + - data.usage.buildsMbSecondsTotal - - )} - {@const progressBarStorageDate = [ - { - size: mbSecondsToGBHours(data.usage.executionsMbSecondsTotal), - color: '#85DBD8', - tooltip: { - title: 'Executions', - label: `${(Math.round(mbSecondsToGBHours(data.usage.executionsMbSecondsTotal) * 100) / 100).toLocaleString('en-US')} GB hours` + + {#if data.usage.executionsMbSecondsTotal} + {@const totalGbHours = mbSecondsToGBHours( + data.usage.executionsMbSecondsTotal + data.usage.buildsMbSecondsTotal + )} + {@const progressBarStorageDate = [ + { + size: mbSecondsToGBHours(data.usage.executionsMbSecondsTotal), + color: '#85DBD8', + tooltip: { + title: 'Executions', + label: `${(Math.round(mbSecondsToGBHours(data.usage.executionsMbSecondsTotal) * 100) / 100).toLocaleString('en-US')} GB hours` + } + }, + { + size: mbSecondsToGBHours(data.usage.buildsMbSecondsTotal), + color: '#FE9567', + tooltip: { + title: 'Deployments', + label: `${(Math.round(mbSecondsToGBHours(data.usage.buildsMbSecondsTotal) * 100) / 100).toLocaleString('en-US')} GB hours` + } } - }, - { - size: mbSecondsToGBHours(data.usage.buildsMbSecondsTotal), - color: '#FE9567', - tooltip: { - title: 'Deployments', - label: `${(Math.round(mbSecondsToGBHours(data.usage.buildsMbSecondsTotal) * 100) / 100).toLocaleString('en-US')} GB hours` - } - } - ]} -
-
-

+ ]} +

+
+

{(Math.ceil(totalGbHours * 100) / 100).toLocaleString('en-US')} - {`GB hours`} -

+ >{(Math.ceil(totalGbHours * 100) / 100).toLocaleString( + 'en-US' + )} + {`GB hours`} +

+
-
- - {:else} - -
+ + {:else} + +
-
- {/if} - +

No data to show

+
+
+ {/if} +

Metrics are estimates updated every 24 hours and may not accurately reflect your invoice.