mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Some bug fixes and cleanup.
This commit is contained in:
@@ -63,6 +63,7 @@ class AccountController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
$index = 1;
|
||||
/** @var Account $account */
|
||||
|
@@ -55,17 +55,25 @@ class BudgetController extends Controller
|
||||
|
||||
while ($first < $last) {
|
||||
$end = Navigation::addPeriod($first, $range, 0);
|
||||
$end->subDay();
|
||||
|
||||
// start date for chart.
|
||||
$chartDate = clone $end;
|
||||
$chartDate->startOfMonth();
|
||||
|
||||
$spent = $repository->spentInPeriodCorrected($budget, $first, $end);
|
||||
$chart->addRow($end, $spent);
|
||||
|
||||
$chart->addRow($chartDate, $spent);
|
||||
|
||||
$first = Navigation::addPeriod($first, $range, 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
$chart->generate();
|
||||
|
||||
$data = $chart->getData();
|
||||
|
||||
|
||||
$cache->store($data);
|
||||
|
||||
return Response::json($data);
|
||||
@@ -242,7 +250,7 @@ class BudgetController extends Controller
|
||||
}
|
||||
$chart->addRowArray($row);
|
||||
|
||||
$start->addMonth();
|
||||
$start->endOfMonth()->addDay();
|
||||
}
|
||||
|
||||
$chart->generate();
|
||||
|
@@ -4,7 +4,6 @@ namespace FireflyIII\Repositories\Shared;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Query\JoinClause;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* Class ComponentRepository
|
||||
@@ -16,15 +15,15 @@ class ComponentRepository
|
||||
|
||||
|
||||
/**
|
||||
* @param stdClass $object
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
* @param $object
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @param bool $shared
|
||||
* @param bool $shared
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function spentInPeriod(stdClass $object, Carbon $start, Carbon $end, $shared = false)
|
||||
protected function spentInPeriod($object, Carbon $start, Carbon $end, $shared = false)
|
||||
{
|
||||
if ($shared === true) {
|
||||
// shared is true.
|
||||
|
@@ -41,6 +41,7 @@ class Navigation
|
||||
'6M' => 6,
|
||||
'half-year' => 6,
|
||||
];
|
||||
$specialMap = ['1M', 'month', 'monthly'];
|
||||
if (!isset($functionMap[$repeatFreq])) {
|
||||
throw new FireflyException('Cannot do addPeriod for $repeat_freq "' . $repeatFreq . '"');
|
||||
}
|
||||
@@ -118,7 +119,7 @@ class Navigation
|
||||
'year' => 'endOfYear',
|
||||
'yearly' => 'endOfYear',
|
||||
];
|
||||
$specials = ['mont', 'monthly'];
|
||||
$specials = ['mont', 'monthly'];
|
||||
|
||||
$currentEnd = clone $theCurrentEnd;
|
||||
|
||||
@@ -270,7 +271,7 @@ class Navigation
|
||||
'3M' => 'lastOfQuarter',
|
||||
'1Y' => 'endOfYear',
|
||||
];
|
||||
$end = clone $start;
|
||||
$end = clone $start;
|
||||
|
||||
if (isset($functionMap[$range])) {
|
||||
$function = $functionMap[$range];
|
||||
|
Reference in New Issue
Block a user