Implement tag count and fix a count thing.

This commit is contained in:
James Cole
2015-06-14 21:27:04 +02:00
parent 1e86794416
commit 620848272e
2 changed files with 17 additions and 5 deletions

View File

@@ -158,14 +158,13 @@ class TransactionJournal extends Model
$amount = $t->amount;
}
}
$count = $this->tags()->count();
if ($count === 1) {
if ($this->tag_count === 1) {
// get amount for single tag:
$amount = $this->amountByTag($this->tags()->first(), $amount);
}
if ($count > 1) {
if ($this->tag_count > 1) {
// get amount for either tag.
$amount = $this->amountByTags($amount);