From 66fb866f420e5b84ed763c4ab6c8e493bc9308dd Mon Sep 17 00:00:00 2001 From: myrmidex Date: Fri, 20 Mar 2026 00:45:48 +0100 Subject: [PATCH] 5 - Clean up dead formatting code and tighten buffer validation --- app/Enums/BucketAllocationTypeEnum.php | 8 -------- app/Http/Controllers/BucketController.php | 4 ++-- app/Models/Bucket.php | 8 -------- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/app/Enums/BucketAllocationTypeEnum.php b/app/Enums/BucketAllocationTypeEnum.php index 9307c00..97f42d6 100644 --- a/app/Enums/BucketAllocationTypeEnum.php +++ b/app/Enums/BucketAllocationTypeEnum.php @@ -31,12 +31,4 @@ public function getAllocationValueRules(): array }; } - public function formatValue(?float $value): string - { - return match ($this) { - self::FIXED_LIMIT => '$'.number_format($value ?? 0, 2), - self::PERCENTAGE => number_format($value ?? 0, 2).'%', - self::UNLIMITED => 'All remaining', - }; - } } diff --git a/app/Http/Controllers/BucketController.php b/app/Http/Controllers/BucketController.php index f2e2341..cab6a3c 100644 --- a/app/Http/Controllers/BucketController.php +++ b/app/Http/Controllers/BucketController.php @@ -33,7 +33,7 @@ public function store(Request $request, Scenario $scenario): JsonResponse 'type' => 'required|in:'.implode(',', BucketTypeEnum::values()), 'allocation_type' => 'required|in:'.implode(',', BucketAllocationTypeEnum::values()), 'allocation_value' => 'nullable|numeric', - 'buffer_multiplier' => 'sometimes|nullable|numeric|min:0', + 'buffer_multiplier' => 'sometimes|numeric|min:0', 'priority' => 'nullable|integer|min:1', ]); @@ -76,7 +76,7 @@ public function update(Request $request, Bucket $bucket): JsonResponse 'type' => 'required|in:'.implode(',', BucketTypeEnum::values()), 'allocation_type' => 'required|in:'.implode(',', BucketAllocationTypeEnum::values()), 'allocation_value' => 'nullable|numeric', - 'buffer_multiplier' => 'sometimes|nullable|numeric|min:0', + 'buffer_multiplier' => 'sometimes|numeric|min:0', 'priority' => 'nullable|integer|min:1', ]); diff --git a/app/Models/Bucket.php b/app/Models/Bucket.php index b00697b..b1cb91b 100644 --- a/app/Models/Bucket.php +++ b/app/Models/Bucket.php @@ -149,14 +149,6 @@ public function getAllocationTypeLabel(): string return $this->allocation_type->getLabel(); } - /** - * Get formatted allocation value for display. - */ - public function getFormattedAllocationValue(): string - { - return $this->allocation_type->formatValue($this->allocation_value); - } - /** * Get allocation value validation rules based on type. */