Skip to content

Commit

Permalink
Fix member transaction api
Browse files Browse the repository at this point in the history
  • Loading branch information
Boldizsar Mezei committed Jul 5, 2023
1 parent c550038 commit 4f28d05
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/app/@api/member.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,15 @@ export class MemberApi extends BaseApi<Member> {
): Observable<Transaction[]> {
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;
Expand Down

0 comments on commit 4f28d05

Please sign in to comment.