From 02c2636b7d59c5feb406506dca81dda257c2c04d Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 17 Nov 2017 05:52:44 +0100 Subject: [PATCH] Fix #997 --- app/Repositories/Tag/TagRepository.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php index 4870c0761d..e8330c11e2 100644 --- a/app/Repositories/Tag/TagRepository.php +++ b/app/Repositories/Tag/TagRepository.php @@ -336,13 +336,13 @@ class TagRepository implements TagRepositoryInterface // add date range (or not): if (null === $year) { $query->whereNull('tags.date'); - $allTags->whereNull('date'); + $allTags->whereNull('tags.date'); } if (null !== $year) { $start = $year . '-01-01'; $end = $year . '-12-31'; $query->where('tags.date', '>=', $start)->where('tags.date', '<=', $end); - $allTags->where('date', '>=', $start)->where('date', '<=', $end); + $allTags->where('tags.date', '>=', $start)->where('tags.date', '<=', $end); } $set = $query->get(['tags.id', DB::raw('SUM(transactions.amount) as amount_sum')]); $tagsWithAmounts = []; @@ -351,7 +351,7 @@ class TagRepository implements TagRepositoryInterface $tagsWithAmounts[$tag->id] = strval($tag->amount_sum); } - $tags = $query->orderBy('id', 'desc')->get(); + $tags = $query->orderBy('tags.id', 'desc')->get(); $temporary = []; /** @var Tag $tag */ foreach ($tags as $tag) {