Skip to content

Commit f451cb3

Browse files
authored
Merge pull request #2051 from appwrite/fix-calc-usage
Fix: usage calc on function.
2 parents 1174fc8 + d7d29bf commit f451cb3

File tree

2 files changed

+8
-1
lines changed
  • src/routes/(console)/project-[region]-[project]/functions/function-[function]/usage/[[period]]

2 files changed

+8
-1
lines changed

src/routes/(console)/project-[region]-[project]/functions/function-[function]/usage/[[period]]/+page.svelte

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
$: count = data.executions;
1010
$: gbHoursTotal = data.executionsMbSecondsTotal / 1000 / 3600;
1111
$: mbSecondsCount = data.executionsMbSeconds;
12+
$: gbHoursCount = data.executionsMbSeconds
13+
?.map((metric) => ({
14+
...metric,
15+
value: metric.value / 1000 / 3600
16+
}))
17+
.filter(({ value }) => value);
1218
</script>
1319

1420
<Container>
@@ -33,7 +39,7 @@
3339
title: 'Total GB hours'
3440
}}
3541
total={gbHoursTotal}
36-
count={mbSecondsCount} />
42+
count={gbHoursCount} />
3743
{/if}
3844
</Layout.Stack>
3945
</Container>

src/routes/(console)/project-[region]-[project]/functions/function-[function]/usage/[[period]]/+page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const load: PageLoad = async ({ params }) => {
77
const period = isValueOfStringEnum(FunctionUsageRange, params.period)
88
? params.period
99
: FunctionUsageRange.ThirtyDays;
10+
1011
return sdk
1112
.forProject(params.region, params.project)
1213
.functions.getUsage(params.function, period);

0 commit comments

Comments
 (0)