Fix amount in tag list [skip ci]

This commit is contained in:
James Cole 2015-06-02 22:07:38 +02:00
parent 72dd064932
commit b935e32340
2 changed files with 25 additions and 9 deletions

View File

@ -219,6 +219,22 @@ class TransactionJournal extends Model
}
/**
* @return string
*/
public function getCorrectAmountAttribute()
{
switch ($this->transactionType->type) {
case 'Deposit':
return $this->transactions()->where('amount', '>', 0)->first()->amount;
case 'Withdrawal':
return $this->transactions()->where('amount', '<', 0)->first()->amount;
}
return '0';
}
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\HasMany

View File

@ -57,7 +57,7 @@
{% if not hideTags %}
{{ relevantTags(journal)|raw }}
{% else %}
{{ journal.correctedActualAmount|formatAmount }}
{{ journal.correctAmount|formatAmount }}
{% endif %}
</td>
<td>