mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-26 02:40:43 -06:00
Fix some chart things. Again.
This commit is contained in:
parent
cb985f5897
commit
0a8f4017bd
@ -147,7 +147,7 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
while ($start <= $end) {
|
while ($start <= $end) {
|
||||||
$spent = $repository->spentOnDaySumCorrected($category, $start);
|
$spent = $repository->spentOnDaySumCorrected($category, $start);
|
||||||
$earned = 0;
|
$earned = $repository->earnedOnDaySumCorrected($category, $start);
|
||||||
if ($spent < 0) {
|
if ($spent < 0) {
|
||||||
$earned = $spent * -1;
|
$earned = $spent * -1;
|
||||||
$spent = 0;
|
$spent = 0;
|
||||||
|
@ -200,7 +200,7 @@ class CategoryRepository extends ComponentRepository implements CategoryReposito
|
|||||||
*/
|
*/
|
||||||
public function spentOnDaySumCorrected(Category $category, Carbon $date)
|
public function spentOnDaySumCorrected(Category $category, Carbon $date)
|
||||||
{
|
{
|
||||||
return $category->transactionjournals()->onDate($date)->get(['transaction_journals.*'])->sum('correct_amount');
|
return $category->transactionjournals()->transactionTypes(['Withdrawal'])->onDate($date)->get(['transaction_journals.*'])->sum('correct_amount');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -355,4 +355,18 @@ class CategoryRepository extends ComponentRepository implements CategoryReposito
|
|||||||
{
|
{
|
||||||
return $category->transactionJournals()->before($end)->after($start)->count();
|
return $category->transactionJournals()->before($end)->after($start)->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Corrected for tags.
|
||||||
|
*
|
||||||
|
* @param Category $category
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function earnedOnDaySumCorrected(Category $category, Carbon $date)
|
||||||
|
{
|
||||||
|
return $category->transactionjournals()->transactionTypes(['Deposit'])->onDate($date)->get(['transaction_journals.*'])->sum('correct_amount');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,6 +145,17 @@ interface CategoryRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function spentOnDaySumCorrected(Category $category, Carbon $date);
|
public function spentOnDaySumCorrected(Category $category, Carbon $date);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Corrected for tags.
|
||||||
|
*
|
||||||
|
* @param Category $category
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return float
|
||||||
|
*/
|
||||||
|
public function earnedOnDaySumCorrected(Category $category, Carbon $date);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user