From 4f28d0516cd928466e52728e1132fbe39c9427c4 Mon Sep 17 00:00:00 2001 From: Boldizsar Mezei Date: Wed, 5 Jul 2023 16:02:43 +0200 Subject: [PATCH] Fix member transaction api --- src/app/@api/member.api.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/@api/member.api.ts b/src/app/@api/member.api.ts index 8f1d4f8..1ae8a95 100644 --- a/src/app/@api/member.api.ts +++ b/src/app/@api/member.api.ts @@ -194,15 +194,15 @@ export class MemberApi extends BaseApi { ): Observable { const orderBys = Array.isArray(orderBy) ? orderBy : [orderBy]; - const all = this.transactionRepo - .getTopTransactionsLive(orderBys, lastValue) + const prevOwner = this.transactionRepo + .getTopTransactionsLive(orderBys, lastValue, undefined, memberId) .pipe(map((result) => result.filter((t) => t.member !== memberId))); const members = this.transactionRepo.getTopTransactionsLive(orderBys, lastValue, memberId); - return combineLatest([all, members]).pipe( - map(([notForMember, forMember]) => - [...notForMember, ...forMember].sort((a, b) => { + return combineLatest([prevOwner, members]).pipe( + map((combined) => + combined.flat().sort((a, b) => { const aTime = a.createdOn?.toDate().getTime() || 0; const bTime = b.createdOn?.toDate().getTime() || 0; return -aTime + bTime;