mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Small code optimisation.
This commit is contained in:
@@ -108,6 +108,10 @@ class ChartJsGenerator implements GeneratorInterface
|
|||||||
],
|
],
|
||||||
'labels' => [],
|
'labels' => [],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// sort by value, keep keys.
|
||||||
|
asort($data);
|
||||||
|
|
||||||
$index = 0;
|
$index = 0;
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
|
|
||||||
|
@@ -336,19 +336,13 @@ class AccountController extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
* @param string $date
|
* @param Carbon $start
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function period(Account $account, string $date)
|
public function period(Account $account, Carbon $start)
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
$start = new Carbon($date);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
throw new FireflyException('"' . e($date) . '" does not seem to be a valid date. Should be in the format YYYY-MM-DD');
|
|
||||||
}
|
|
||||||
$range = Preferences::get('viewRange', '1M')->data;
|
$range = Preferences::get('viewRange', '1M')->data;
|
||||||
$end = Navigation::endOfPeriod($start, $range);
|
$end = Navigation::endOfPeriod($start, $range);
|
||||||
$cache = new CacheProperties();
|
$cache = new CacheProperties();
|
||||||
|
Reference in New Issue
Block a user