mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 17:33:45 +00:00
Some bug fixes and cleanup.
This commit is contained in:
@@ -63,6 +63,7 @@ class AccountController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
$index = 1;
|
$index = 1;
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
|
@@ -55,17 +55,25 @@ class BudgetController extends Controller
|
|||||||
|
|
||||||
while ($first < $last) {
|
while ($first < $last) {
|
||||||
$end = Navigation::addPeriod($first, $range, 0);
|
$end = Navigation::addPeriod($first, $range, 0);
|
||||||
|
$end->subDay();
|
||||||
|
|
||||||
|
// start date for chart.
|
||||||
|
$chartDate = clone $end;
|
||||||
|
$chartDate->startOfMonth();
|
||||||
|
|
||||||
$spent = $repository->spentInPeriodCorrected($budget, $first, $end);
|
$spent = $repository->spentInPeriodCorrected($budget, $first, $end);
|
||||||
$chart->addRow($end, $spent);
|
$chart->addRow($chartDate, $spent);
|
||||||
|
|
||||||
|
|
||||||
$first = Navigation::addPeriod($first, $range, 0);
|
$first = Navigation::addPeriod($first, $range, 0);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$chart->generate();
|
$chart->generate();
|
||||||
|
|
||||||
$data = $chart->getData();
|
$data = $chart->getData();
|
||||||
|
|
||||||
|
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
@@ -242,7 +250,7 @@ class BudgetController extends Controller
|
|||||||
}
|
}
|
||||||
$chart->addRowArray($row);
|
$chart->addRowArray($row);
|
||||||
|
|
||||||
$start->addMonth();
|
$start->endOfMonth()->addDay();
|
||||||
}
|
}
|
||||||
|
|
||||||
$chart->generate();
|
$chart->generate();
|
||||||
|
@@ -4,7 +4,6 @@ namespace FireflyIII\Repositories\Shared;
|
|||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Query\JoinClause;
|
use Illuminate\Database\Query\JoinClause;
|
||||||
use stdClass;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ComponentRepository
|
* Class ComponentRepository
|
||||||
@@ -16,15 +15,15 @@ class ComponentRepository
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param stdClass $object
|
* @param $object
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @param bool $shared
|
* @param bool $shared
|
||||||
*
|
*
|
||||||
* @return string
|
* @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) {
|
if ($shared === true) {
|
||||||
// shared is true.
|
// shared is true.
|
||||||
|
@@ -41,6 +41,7 @@ class Navigation
|
|||||||
'6M' => 6,
|
'6M' => 6,
|
||||||
'half-year' => 6,
|
'half-year' => 6,
|
||||||
];
|
];
|
||||||
|
$specialMap = ['1M', 'month', 'monthly'];
|
||||||
if (!isset($functionMap[$repeatFreq])) {
|
if (!isset($functionMap[$repeatFreq])) {
|
||||||
throw new FireflyException('Cannot do addPeriod for $repeat_freq "' . $repeatFreq . '"');
|
throw new FireflyException('Cannot do addPeriod for $repeat_freq "' . $repeatFreq . '"');
|
||||||
}
|
}
|
||||||
@@ -118,7 +119,7 @@ class Navigation
|
|||||||
'year' => 'endOfYear',
|
'year' => 'endOfYear',
|
||||||
'yearly' => 'endOfYear',
|
'yearly' => 'endOfYear',
|
||||||
];
|
];
|
||||||
$specials = ['mont', 'monthly'];
|
$specials = ['mont', 'monthly'];
|
||||||
|
|
||||||
$currentEnd = clone $theCurrentEnd;
|
$currentEnd = clone $theCurrentEnd;
|
||||||
|
|
||||||
@@ -270,7 +271,7 @@ class Navigation
|
|||||||
'3M' => 'lastOfQuarter',
|
'3M' => 'lastOfQuarter',
|
||||||
'1Y' => 'endOfYear',
|
'1Y' => 'endOfYear',
|
||||||
];
|
];
|
||||||
$end = clone $start;
|
$end = clone $start;
|
||||||
|
|
||||||
if (isset($functionMap[$range])) {
|
if (isset($functionMap[$range])) {
|
||||||
$function = $functionMap[$range];
|
$function = $functionMap[$range];
|
||||||
|
14
composer.lock
generated
14
composer.lock
generated
@@ -3647,16 +3647,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "4.6.10",
|
"version": "4.7.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "7b5fe98b28302a8b25693b2298bca74463336975"
|
"reference": "c2241b8d3381be3e4c6125ae347687d59f286784"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7b5fe98b28302a8b25693b2298bca74463336975",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c2241b8d3381be3e4c6125ae347687d59f286784",
|
||||||
"reference": "7b5fe98b28302a8b25693b2298bca74463336975",
|
"reference": "c2241b8d3381be3e4c6125ae347687d59f286784",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3667,7 +3667,7 @@
|
|||||||
"ext-spl": "*",
|
"ext-spl": "*",
|
||||||
"php": ">=5.3.3",
|
"php": ">=5.3.3",
|
||||||
"phpspec/prophecy": "~1.3,>=1.3.1",
|
"phpspec/prophecy": "~1.3,>=1.3.1",
|
||||||
"phpunit/php-code-coverage": "~2.0,>=2.0.11",
|
"phpunit/php-code-coverage": "~2.1",
|
||||||
"phpunit/php-file-iterator": "~1.4",
|
"phpunit/php-file-iterator": "~1.4",
|
||||||
"phpunit/php-text-template": "~1.2",
|
"phpunit/php-text-template": "~1.2",
|
||||||
"phpunit/php-timer": "~1.0",
|
"phpunit/php-timer": "~1.0",
|
||||||
@@ -3689,7 +3689,7 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "4.6.x-dev"
|
"dev-master": "4.7.x-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@@ -3715,7 +3715,7 @@
|
|||||||
"testing",
|
"testing",
|
||||||
"xunit"
|
"xunit"
|
||||||
],
|
],
|
||||||
"time": "2015-06-03 05:03:30"
|
"time": "2015-06-05 04:14:02"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit-mock-objects",
|
"name": "phpunit/phpunit-mock-objects",
|
||||||
|
Reference in New Issue
Block a user