Skip to content

Commit d39d1cb

Browse files
Fix metric calculation to handle empty JSON arrays in MetricKeberadaan
1 parent ad1355d commit d39d1cb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/Nova/Metrics/MetricKeberadaan.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function calculate(NovaRequest $request): PartitionResult
6868
$results = DB::query()
6969
->selectRaw(
7070
$this->null_strict ?
71-
"SUM(CASE WHEN {$this->column} IS NOT NULL THEN 1 ELSE 0 END) as ada, SUM(CASE WHEN {$this->column} IS NULL THEN 1 ELSE 0 END) as tidak" :
71+
"SUM(CASE WHEN {$this->column} IS NOT NULL AND {$this->column} != '[]' THEN 1 ELSE 0 END) as ada, SUM(CASE WHEN {$this->column} IS NULL OR {$this->column} = '[]' THEN 1 ELSE 0 END) as tidak" :
7272
"SUM(CASE WHEN {$this->column} > 0 THEN 1 ELSE 0 END) as ada, SUM(CASE WHEN {$this->column} <= 0 THEN 1 ELSE 0 END) as tidak"
7373
)
7474
->fromSub($table, 'sub')

0 commit comments

Comments
 (0)