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:
		| @@ -77,6 +77,7 @@ class BudgetController extends Controller | ||||
|             } | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Shows overview of a single budget. | ||||
|      * | ||||
| @@ -141,6 +142,7 @@ class BudgetController extends Controller | ||||
|  | ||||
|         return response()->json($data); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Shows the amount left in a specific budget limit. | ||||
|      * | ||||
| @@ -167,7 +169,7 @@ class BudgetController extends Controller | ||||
|         $cache->addProperty($budget->id); | ||||
|  | ||||
|         if ($cache->has()) { | ||||
|              return response()->json($cache->get()); // @codeCoverageIgnore | ||||
|             return response()->json($cache->get()); // @codeCoverageIgnore | ||||
|         } | ||||
|         $locale           = app('steam')->getLocale(); | ||||
|         $entries          = []; | ||||
| @@ -192,6 +194,7 @@ class BudgetController extends Controller | ||||
|  | ||||
|         return response()->json($data); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Shows how much is spent per asset account. | ||||
|      * | ||||
| @@ -259,6 +262,7 @@ class BudgetController extends Controller | ||||
|  | ||||
|         return response()->json($data); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Shows how much is spent per category. | ||||
|      * | ||||
| @@ -322,6 +326,7 @@ class BudgetController extends Controller | ||||
|  | ||||
|         return response()->json($data); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Shows how much is spent per expense account. | ||||
|      * | ||||
| @@ -388,6 +393,7 @@ class BudgetController extends Controller | ||||
|  | ||||
|         return response()->json($data); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Shows a budget list with spent/left/overspent. | ||||
|      * | ||||
| @@ -419,6 +425,7 @@ class BudgetController extends Controller | ||||
|  | ||||
|         return response()->json($data); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Shows a budget overview chart (spent and budgeted). | ||||
|      * | ||||
| @@ -477,13 +484,13 @@ class BudgetController extends Controller | ||||
|             // get budget limit in this period for this currency. | ||||
|             $limit = $this->blRepository->find($budget, $currency, $currentStart, $currentEnd); | ||||
|             if (null !== $limit) { | ||||
|                 $chartData[1]['entries'][$title] = round((float) $limit->amount, $currency->decimal_places); | ||||
|                 $chartData[1]['entries'][$title] = round((float)$limit->amount, $currency->decimal_places); | ||||
|             } | ||||
|  | ||||
|             // get spent amount in this period for this currency. | ||||
|             $sum                             = $this->opsRepository->sumExpenses($currentStart, $currentEnd, $accounts, new Collection([$budget]), $currency); | ||||
|             $amount                          = app('steam')->positive($sum[$currency->id]['sum'] ?? '0'); | ||||
|             $chartData[0]['entries'][$title] = round((float) $amount, $currency->decimal_places); | ||||
|             $chartData[0]['entries'][$title] = round((float)$amount, $currency->decimal_places); | ||||
|  | ||||
|             $currentStart = clone $currentEnd; | ||||
|             $currentStart->addDay()->startOfDay(); | ||||
| @@ -494,6 +501,7 @@ class BudgetController extends Controller | ||||
|  | ||||
|         return response()->json($data); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Shows a chart for transactions without a budget. | ||||
|      * | ||||
| @@ -527,7 +535,7 @@ class BudgetController extends Controller | ||||
|             $title             = $currentStart->formatLocalized($titleFormat); | ||||
|             $sum               = $this->nbRepository->sumExpenses($currentStart, $currentEnd, $accounts, $currency); | ||||
|             $amount            = app('steam')->positive($sum[$currency->id]['sum'] ?? '0'); | ||||
|             $chartData[$title] = round((float) $amount, $currency->decimal_places); | ||||
|             $chartData[$title] = round((float)$amount, $currency->decimal_places); | ||||
|             $currentStart      = app('navigation')->addPeriod($currentStart, $preferredRange, 0); | ||||
|         } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user