fix gitlab tests

This commit is contained in:
root
2026-06-09 02:32:58 -04:00
parent 20a0b6c4e5
commit 6def9993da
1489 changed files with 10449 additions and 11356 deletions
@@ -7,7 +7,9 @@ use Illuminate\Support\Facades\DB;
class InventorySummaryService
{
public function __construct(private InventoryContextService $context) {}
public function __construct(private InventoryContextService $context)
{
}
public function summary(string $type, ?string $schoolYear): array
{
@@ -22,7 +24,7 @@ class InventorySummaryService
$itemIds = array_map(static fn ($i) => (int) ($i['id'] ?? 0), $items);
$agg = [];
if (! empty($itemIds)) {
if (!empty($itemIds)) {
$qb = DB::table('inventory_movements')
->selectRaw('item_id,
SUM(CASE WHEN qty_change>0 THEN qty_change ELSE 0 END) AS received,
@@ -63,7 +65,7 @@ class InventorySummaryService
->leftJoin('users as u', 'u.id', '=', 'i.updated_by')
->orderBy('i.name');
if (! $isAllYears) {
if (!$isAllYears) {
$qbItems->where('i.school_year', $selectedYear);
}
@@ -85,7 +87,7 @@ class InventorySummaryService
'variance' => 0,
];
if (! empty($items)) {
if (!empty($items)) {
$itemIds = array_map('intval', array_column($items, 'id'));
$aggById = [];
$qb = DB::table('inventory_movements as m')
@@ -100,7 +102,7 @@ class InventorySummaryService
->whereIn('m.item_id', $itemIds)
->groupBy('m.item_id');
if (! $isAllYears) {
if (!$isAllYears) {
$qb->where('m.school_year', $selectedYear);
}
@@ -180,7 +182,7 @@ class InventorySummaryService
->all();
$currentYear = $this->context->schoolYear();
if ($currentYear && ! in_array($currentYear, $years, true)) {
if ($currentYear && !in_array($currentYear, $years, true)) {
array_unshift($years, $currentYear);
}