Skip to content

Commit

Permalink
Merge pull request #65 from cash-track/feature/profile-statistics
Browse files Browse the repository at this point in the history
Feature / Profile Statistics
  • Loading branch information
vokomarov authored Oct 16, 2021
2 parents 9426274 + dfdba17 commit 827bd45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/src/Controller/Profile/ProfileStatisticsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function walletsLatest(
ChargeRepository $chargeRepository,
WalletsView $view
): ResponseInterface {
$wallets = $walletRepository->findAllUnArchivedByUserPKWithLimit($this->user->id);
$wallets = $walletRepository->findByUserPKLatestWithLimit($this->user->id);

foreach ($wallets as $wallet) {
$wallet->latestCharges = new ArrayCollection($chargeRepository->findByWalletIDLatest($wallet->id));
Expand Down
7 changes: 5 additions & 2 deletions app/src/Repository/WalletRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ public function findAllByUserPKByArchived(int $userID, bool $isArchived = false)
* @param int $limit
* @return \App\Database\Wallet[]
*/
public function findAllUnArchivedByUserPKWithLimit(int $userID, int $limit = 4): array
public function findByUserPKLatestWithLimit(int $userID, int $limit = 4): array
{
/** @var \App\Database\Wallet[] $wallets */
$wallets = $this->allByUserPK($userID)->where('is_archived', false)->limit($limit)->fetchAll();
$wallets = $this->allByUserPK($userID)
->limit($limit)
->orderBy('updated_at', 'DESC')
->fetchAll();

return $wallets;
}
Expand Down

0 comments on commit 827bd45

Please sign in to comment.