mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 20:16:22 +00:00
This fixes what turns out to be an incredibly inaccurate chart.
This commit is contained in:
@@ -370,39 +370,6 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
||||
return $set;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the expenses for this budget grouped per month, with the date
|
||||
* in "dateFormatted" (a string, not a Carbon) and the amount in "dailyAmount".
|
||||
*
|
||||
* @param Budget $budget
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getExpensesPerMonth(Budget $budget, Carbon $start, Carbon $end)
|
||||
{
|
||||
$set = Auth::user()->budgets()
|
||||
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.budget_id', '=', 'budgets.id')
|
||||
->leftJoin('transaction_journals', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->where('transaction_journals.date', '>=', $start->format('Y-m-d'))
|
||||
->where('transaction_journals.date', '<=', $end->format('Y-m-d'))
|
||||
->whereNull('transaction_journals.deleted_at')
|
||||
->where('budgets.id', $budget->id)
|
||||
->where('transactions.amount', '<', 0)
|
||||
->groupBy('dateFormatted')
|
||||
->orderBy('transaction_journals.date')
|
||||
->get(
|
||||
[
|
||||
DB::raw('DATE_FORMAT(`transaction_journals`.`date`, "%Y-%m") AS `dateFormatted`'),
|
||||
DB::raw('SUM(`transactions`.`amount`) as `monthlyAmount`'),
|
||||
]
|
||||
);
|
||||
|
||||
return $set;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Budget $budget
|
||||
*
|
||||
|
@@ -136,18 +136,6 @@ interface BudgetRepositoryInterface
|
||||
*/
|
||||
public function getExpensesPerDay(Budget $budget, Carbon $start, Carbon $end);
|
||||
|
||||
/**
|
||||
* Returns the expenses for this budget grouped per month, with the date
|
||||
* in "date" (a string, not a Carbon) and the amount in "dailyAmount".
|
||||
*
|
||||
* @param Budget $budget
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getExpensesPerMonth(Budget $budget, Carbon $start, Carbon $end);
|
||||
|
||||
/**
|
||||
* @param Budget $budget
|
||||
*
|
||||
|
Reference in New Issue
Block a user