Expanded some tests.

This commit is contained in:
James Cole
2015-06-05 07:49:07 +02:00
parent fea9bc4e7e
commit d483005219
4 changed files with 96 additions and 12 deletions

View File

@@ -9,7 +9,6 @@ use FireflyIII\Models\Account;
use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use Illuminate\Support\Collection;
/**
* Class TagRepository
@@ -64,14 +63,15 @@ class TagRepository implements TagRepositoryInterface
* @param Carbon $start
* @param Carbon $end
*
* @return integer
* @return string
*/
public function coveredByBalancingActs(Account $account, Carbon $start, Carbon $end)
{
// the quickest way to do this is by scanning all balancingAct tags
// because there will be less of them any way.
$tags = Auth::user()->tags()->where('tagMode', 'balancingAct')->get();
$amount = 0;
$amount = '0';
bcscale(2);
/** @var Tag $tag */
foreach ($tags as $tag) {
@@ -80,7 +80,7 @@ class TagRepository implements TagRepositoryInterface
/** @var TransactionJournal $journal */
foreach ($journals as $journal) {
if ($journal->destination_account->id == $account->id) {
$amount += $journal->amount;
$amount = bcadd($amount, $journal->amount);
}
}
}

View File

@@ -38,7 +38,7 @@ interface TagRepositoryInterface
* @param Carbon $start
* @param Carbon $end
*
* @return float
* @return string
*/
public function coveredByBalancingActs(Account $account, Carbon $start, Carbon $end);