mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-18 07:38:29 +00:00
Improve mass controller and test controllers.
This commit is contained in:
@@ -41,7 +41,7 @@ class ShowController extends Controller
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ConvertController constructor.
|
||||
* ShowController constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -81,8 +81,29 @@ class ShowController extends Controller
|
||||
$groupArray = $transformer->transformObject($transactionGroup);
|
||||
|
||||
// do some amount calculations:
|
||||
$amounts = $this->getAmounts($groupArray);
|
||||
|
||||
|
||||
$events = $this->repository->getPiggyEvents($transactionGroup);
|
||||
$attachments = $this->repository->getAttachments($transactionGroup);
|
||||
$links = $this->repository->getLinks($transactionGroup);
|
||||
|
||||
return view(
|
||||
'transactions.show', compact(
|
||||
'transactionGroup', 'amounts', 'first', 'type', 'subTitle', 'splits', 'groupArray',
|
||||
'events', 'attachments', 'links', 'message'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $group
|
||||
* @return array
|
||||
*/
|
||||
private function getAmounts(array $group): array
|
||||
{
|
||||
$amounts = [];
|
||||
foreach ($groupArray['transactions'] as $transaction) {
|
||||
foreach ($group['transactions'] as $transaction) {
|
||||
$symbol = $transaction['currency_symbol'];
|
||||
if (!isset($amounts[$symbol])) {
|
||||
$amounts[$symbol] = [
|
||||
@@ -106,15 +127,6 @@ class ShowController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$events = $this->repository->getPiggyEvents($transactionGroup);
|
||||
$attachments = $this->repository->getAttachments($transactionGroup);
|
||||
$links = $this->repository->getLinks($transactionGroup);
|
||||
|
||||
return view(
|
||||
'transactions.show', compact(
|
||||
'transactionGroup', 'amounts', 'first', 'type', 'subTitle', 'splits', 'groupArray',
|
||||
'events', 'attachments', 'links', 'message'
|
||||
)
|
||||
);
|
||||
return $amounts;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user