Show tag amount better [skip ci]

This commit is contained in:
James Cole
2015-05-18 17:02:18 +02:00
parent b637455970
commit 064e60e9d5
2 changed files with 18 additions and 1 deletions

View File

@@ -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;
}