@@ -731,24 +731,24 @@ public function aggregateTotal(
731
731
}." as {$ this ->wrap ($ aggregate )}" )
732
732
->fromSub (fn (Builder $ query ) => $ query
733
733
// Buckets
734
- ->addSelect ('type ' )
735
- ->selectRaw (match ($ aggregate ) {
736
- 'count ' => "sum( {$ this ->wrap ('value ' )}) " ,
737
- 'min ' => "min( {$ this ->wrap ('value ' )}) " ,
738
- 'max ' => "max( {$ this ->wrap ('value ' )}) " ,
739
- 'sum ' => "sum( {$ this ->wrap ('value ' )}) " ,
740
- 'avg ' => "avg( {$ this ->wrap ('value ' )}) " ,
741
- }." as {$ this ->wrap ($ aggregate )}" )
742
- ->from ('datum_aggregates ' )
743
- ->where ('period ' , $ interval ->value )
744
- ->when (
745
- is_array ($ types ),
746
- fn ($ query ) => $ query ->whereIn ('type ' , $ types ),
747
- fn ($ query ) => $ query ->where ('type ' , $ types )
748
- )
749
- ->where ('aggregate ' , $ aggregate )
750
- ->where ('bucket ' , '>= ' , $ window ['start ' ])
751
- ->groupBy ('type ' ), as: 'child '
734
+ ->addSelect ('type ' )
735
+ ->selectRaw (match ($ aggregate ) {
736
+ 'count ' => "sum( {$ this ->wrap ('value ' )}) " ,
737
+ 'min ' => "min( {$ this ->wrap ('value ' )}) " ,
738
+ 'max ' => "max( {$ this ->wrap ('value ' )}) " ,
739
+ 'sum ' => "sum( {$ this ->wrap ('value ' )}) " ,
740
+ 'avg ' => "avg( {$ this ->wrap ('value ' )}) " ,
741
+ }." as {$ this ->wrap ($ aggregate )}" )
742
+ ->from ('datum_aggregates ' )
743
+ ->where ('period ' , $ interval ->value )
744
+ ->when (
745
+ is_array ($ types ),
746
+ fn ($ query ) => $ query ->whereIn ('type ' , $ types ),
747
+ fn ($ query ) => $ query ->where ('type ' , $ types )
748
+ )
749
+ ->where ('aggregate ' , $ aggregate )
750
+ ->where ('bucket ' , '>= ' , $ window ['start ' ])
751
+ ->groupBy ('type ' ), as: 'child '
752
752
)
753
753
->groupBy ('type ' )
754
754
->when (
0 commit comments