Skip to content

Firefly III: a personal finances manager

Show tag amount better [skip ci]

James Cole064e60e9d559
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index fc98ff41be..5dc0b73550 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -59,6 +59,22 @@ class TransactionJournal extends Model
return $this->belongsToMany('FireflyIII\Models\Category');
}
+ /**
+ * @return float
+ */
+ public function getActualAmountAttribute()
+ {
+ $amount = 0;
+ /** @var Transaction $t */
+ foreach ($this->transactions as $t) {
+ if ($t->amount > 0) {
+ $amount = floatval($t->amount);
+ }
+ }
+
+ return $amount;
+ }
+
/**
* @return float
*/
@@ -88,6 +104,7 @@ class TransactionJournal extends Model
foreach ($others as $other) {
$amount -= $other->amount;
}
+
return $amount;
}
diff --git a/resources/twig/list/journals.twig b/resources/twig/list/journals.twig
index 32a742aa44..c62a069636 100644
--- a/resources/twig/list/journals.twig
+++ b/resources/twig/list/journals.twig
@@ -57,7 +57,7 @@
{% if not hideTags %}
{{ relevantTags(journal)|raw }}
{% else %}
- {{ journal|formatJournal }}
+ {{ journal.actualAmount|formatAmount }}
{% endif %}
</td>
<td>