Skip to content

Commit

Permalink
fix: correct sorting order
Browse files Browse the repository at this point in the history
  • Loading branch information
thevaibhav-dixit committed Jul 11, 2024
1 parent dba5877 commit 1792d34
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cala-ledger/src/account_set/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,12 @@ impl AccountSetRepo {
));
}
}
let ids = account_ids
let mut ids = account_ids
.into_iter()
.take(args.first)
.chain(account_set_ids.into_iter().take(args.first))
.collect::<Vec<_>>();
ids.sort_by_key(|(_, created_at)| std::cmp::Reverse(*created_at));

Ok(query::PaginatedQueryRet {
entities: ids,
Expand Down
4 changes: 2 additions & 2 deletions cala-server/src/graphql/account_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl AccountSet {
.await?;
let mut account_ids = Vec::new();
let mut set_ids = Vec::new();
for (id, ..) in ids.entities.iter() {
for (id, _) in ids.entities.iter() {
match id {
AccountSetMemberId::Account(id) => account_ids.push(*id),
AccountSetMemberId::AccountSet(id) => set_ids.push(*id),
Expand All @@ -115,7 +115,7 @@ impl AccountSet {
.await?;
let mut account_ids = Vec::new();
let mut set_ids = Vec::new();
for (id, ..) in ids.entities.iter() {
for (id, _) in ids.entities.iter() {
match id {
AccountSetMemberId::Account(id) => account_ids.push(*id),
AccountSetMemberId::AccountSet(id) => set_ids.push(*id),
Expand Down

0 comments on commit 1792d34

Please sign in to comment.