Some new tests and fixes. [skip ci]

This commit is contained in:
James Cole
2014-07-23 06:57:51 +02:00
parent 9d142aa8b0
commit cc71a1116a
15 changed files with 397 additions and 97 deletions

View File

@@ -87,7 +87,7 @@ class BudgetController extends BaseController
'repeats' => intval(Input::get('repeats'))
];
$budget = $this->_budgets->create($data);
$this->_budgets->store($data);
Session::flash('success', 'Budget created!');
return Redirect::route('budgets.index');
}
@@ -106,31 +106,29 @@ class BudgetController extends BaseController
$return[$month][] = $entry;
}
$str = '';
foreach ($return as $month => $set) {
echo '<h1>' . $month . '</h1>';
$str .= '<h1>' . $month . '</h1>';
/** @var \TransactionJournal $tj */
$sum = 0;
foreach ($set as $tj) {
echo '#' . $tj->id . ' ' . $tj->description . ': ';
$str .= '#' . $tj->id . ' ' . $tj->description . ': ';
foreach ($tj->transactions as $index => $t) {
echo $t->amount . ', ';
$str .= $t->amount . ', ';
if ($index == 0) {
$sum += $t->amount;
}
}
echo '<br>';
$str .= '<br>';
}
echo 'sum: ' . $sum . '<br><br>';
$str .= 'sum: ' . $sum . '<br><br>';
}
exit;
return View::make('budgets.show');
return $str;
}

View File

@@ -1,7 +1,8 @@
<?php
use Firefly\Exception\FireflyException;
use Firefly\Helper\Preferences\PreferencesHelperInterface as PHI;
use Firefly\Helper\Toolkit\Toolkit as tk;
use Firefly\Helper\Toolkit\ToolkitInterface as tk;
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
use Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface as TJRI;
@@ -36,6 +37,7 @@ class ChartController extends BaseController
public function homeAccount($accountId = null)
{
list($start, $end) = $this->_tk->getDateRange();
\Log::debug('Start is (cannot clone?): ' . $start);
$current = clone $start;
$return = [];
$account = null;
@@ -73,8 +75,10 @@ class ChartController extends BaseController
}
} else {
$return[0] = ['name' => $account->name, 'id' => $account->id, 'data' => []];
\Log::debug('Start is: '.$start);
\Log::debug('End is: '.$end);
while ($current <= $end) {
\Log::debug('Current: ' . $current.' is smaller or equal to ' . $end);
if ($current > $today) {
$return[0]['data'][] = [$current->timestamp * 1000, $account->predict(clone $current)];
} else {