mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Code cleanup.
This commit is contained in:
		| @@ -42,6 +42,7 @@ use Illuminate\Support\Collection; | ||||
| class BudgetReportController extends Controller | ||||
| { | ||||
|     use AugumentData, TransactionCalculation; | ||||
|  | ||||
|     /** @var GeneratorInterface Chart generation methods. */ | ||||
|     private $generator; | ||||
|  | ||||
| @@ -199,7 +200,7 @@ class BudgetReportController extends Controller | ||||
|             $chartData[$spentKey] = $chartData[$spentKey] ?? [ | ||||
|                     'label'           => sprintf( | ||||
|                         '%s (%s)', | ||||
|                         (string) trans('firefly.spent_in_specific_budget', ['budget' => $budget->name]), | ||||
|                         (string)trans('firefly.spent_in_specific_budget', ['budget' => $budget->name]), | ||||
|                         $currency['currency_name'] | ||||
|                     ), | ||||
|                     'type'            => 'bar', | ||||
| @@ -224,6 +225,29 @@ class BudgetReportController extends Controller | ||||
|         return response()->json($data); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param Carbon $start | ||||
|      * @param Carbon $end | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     private function makeEntries(Carbon $start, Carbon $end): array | ||||
|     { | ||||
|         $return         = []; | ||||
|         $format         = app('navigation')->preferredCarbonLocalizedFormat($start, $end); | ||||
|         $preferredRange = app('navigation')->preferredRangeFormat($start, $end); | ||||
|         $currentStart   = clone $start; | ||||
|         while ($currentStart <= $end) { | ||||
|             $currentEnd   = app('navigation')->endOfPeriod($currentStart, $preferredRange); | ||||
|             $key          = $currentStart->formatLocalized($format); | ||||
|             $return[$key] = '0'; | ||||
|             $currentStart = clone $currentEnd; | ||||
|             $currentStart->addDay()->startOfDay(); | ||||
|         } | ||||
|  | ||||
|         return $return; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Chart that groups expenses by the account. | ||||
|      * | ||||
| @@ -260,27 +284,4 @@ class BudgetReportController extends Controller | ||||
|  | ||||
|         return response()->json($data); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * @param Carbon $start | ||||
|      * @param Carbon $end | ||||
|      * | ||||
|      * @return array | ||||
|      */ | ||||
|     private function makeEntries(Carbon $start, Carbon $end): array | ||||
|     { | ||||
|         $return         = []; | ||||
|         $format         = app('navigation')->preferredCarbonLocalizedFormat($start, $end); | ||||
|         $preferredRange = app('navigation')->preferredRangeFormat($start, $end); | ||||
|         $currentStart   = clone $start; | ||||
|         while ($currentStart <= $end) { | ||||
|             $currentEnd   = app('navigation')->endOfPeriod($currentStart, $preferredRange); | ||||
|             $key          = $currentStart->formatLocalized($format); | ||||
|             $return[$key] = '0'; | ||||
|             $currentStart = clone $currentEnd; | ||||
|             $currentStart->addDay()->startOfDay(); | ||||
|         } | ||||
|  | ||||
|         return $return; | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user