mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-11-03 20:55:05 +00:00 
			
		
		
		
	Removed "amount" attribute. This breaks half of Firefly III.
This commit is contained in:
		@@ -97,30 +97,6 @@ class TransactionJournal extends Model
 | 
			
		||||
        return $this->belongsToMany('FireflyIII\Models\Category');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return float
 | 
			
		||||
     */
 | 
			
		||||
    public function getAmountAttribute()
 | 
			
		||||
    {
 | 
			
		||||
        $cache = new CacheProperties();
 | 
			
		||||
        $cache->addProperty($this->id);
 | 
			
		||||
        $cache->addProperty('amount');
 | 
			
		||||
        if ($cache->has()) {
 | 
			
		||||
            return $cache->get(); // @codeCoverageIgnore
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        bcscale(2);
 | 
			
		||||
        $transaction = $this->transactions->sortByDesc('amount')->first();
 | 
			
		||||
        $amount      = $transaction->amount;
 | 
			
		||||
        if ($this->isWithdrawal()) {
 | 
			
		||||
            $amount = bcmul($amount, '-1');
 | 
			
		||||
        }
 | 
			
		||||
        $cache->store($amount);
 | 
			
		||||
 | 
			
		||||
        return $amount;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user