mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Add some debug, fix balance report bug.
This commit is contained in:
@@ -203,9 +203,24 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
{
|
||||
$query = LimitRepetition::leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
|
||||
->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
|
||||
->where('limit_repetitions.startdate', '<=', $end->format('Y-m-d 00:00:00'))
|
||||
->where('limit_repetitions.startdate', '>=', $start->format('Y-m-d 00:00:00'))
|
||||
->where('budgets.user_id', $this->user->id);
|
||||
->where(
|
||||
function (Builder $q1) use ($start, $end) {
|
||||
$q1->where(
|
||||
function (Builder $q2) use ($start, $end) {
|
||||
$q2->where('limit_repetitions.enddate', '>=', $start->format('Y-m-d 00:00:00'));
|
||||
$q2->where('limit_repetitions.enddate', '<=', $end->format('Y-m-d 00:00:00'));
|
||||
}
|
||||
)
|
||||
->orWhere(
|
||||
function (Builder $q3) use ($start, $end) {
|
||||
$q3->where('limit_repetitions.startdate', '>=', $start->format('Y-m-d 00:00:00'));
|
||||
$q3->where('limit_repetitions.startdate', '<=', $end->format('Y-m-d 00:00:00'));
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
->where('budgets.user_id', $this->user->id)
|
||||
->whereNull('budgets.deleted_at');
|
||||
|
||||
$set = $query->get(['limit_repetitions.*', 'budget_limits.budget_id']);
|
||||
|
||||
@@ -383,10 +398,11 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
public function spentInPeriod(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): string
|
||||
{
|
||||
// collect amount of transaction journals, which is easy:
|
||||
$budgetIds = $budgets->pluck('id')->toArray();
|
||||
$budgetIds = $budgets->pluck('id')->toArray();
|
||||
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
|
||||
Log::debug('spentInPeriod: Now in spentInPeriod for these budgets: ', $budgetIds);
|
||||
Log::debug(sprintf('spentInPeriod: Now in spentInPeriod for these budgets (%d): ', count($budgetIds)), $budgetIds);
|
||||
Log::debug('spentInPeriod: and these accounts: ', $accountIds);
|
||||
Log::debug(sprintf('spentInPeriod: Start date is "%s", end date is "%s"', $start->format('Y-m-d'), $end->format('Y-m-d')));
|
||||
|
||||
|
Reference in New Issue
Block a user