-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: members query in account set #165
Conversation
Just did some testing with this branch. This is still pretty broken. It's grouping Accounts and then AccountSets in the returned list (sorted by cursor within each group). For e.g, I'm getting (with time as proxy for cursor ordering):
And if I paginate after
We should probably figure out a way to test expected ordering as well |
I just added a branch to help with testing pagination. It seeds a list of accounts/accountSets under a https://github.com/GaloyMoney/cala/compare/test-pagination To initialize:
To test, get the full list with this query, and then in a new tab choose different items to paginate from {
accountSet(id: "00000000-0000-0000-0000-100000000000") {
name
members(first: 100) {
edges {
cursor
node {
... on Account {
__typename
id
name
}
... on AccountSet {
__typename
id
name
}
}
}
}
}
} The bugAfter drilling in further with this, the bug I found was that if you try to paginate from an AccountSet specifically (e.g. |
is this not the expected behaviour ? we are getting all the accounts/ account sets that were created before Time @ 4 |
There's no concept of time in the end-user pagination interface I think, we just use that as an implementation detail to do our ordering. If I was looking at the first list and paginating from Time 4 I would expect all items under it in the page, and ordered in the order the page was first presented:
But to be more correct (like it currently is on
And if I paginated from Time 4 I'd expect the following in the order presented:
|
8e924ac
to
1792d34
Compare
cala-ledger/src/account_set/repo.rs
Outdated
|
||
for row in rows.into_iter() { | ||
if let Some(member_account_id) = row.member_account_id { | ||
account_ids.push(( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not instantiate the proper type here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was not sure if we could sort the struct... But can try that
06cdab7
to
86ac85e
Compare
9bedd21
to
6a1bb3c
Compare
cala-ledger/tests/account_set.rs
Outdated
); | ||
|
||
let after_cursor = AccountSetMemberCursor { | ||
member_created_at: ret.entities[0].created_at, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't ret have the cursor? Why construct it>?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it does have an end cursor. here i am creating cursor using the first element to better test
@@ -20,3 +20,9 @@ impl From<&AccountSetValues> for AccountSetByNameCursor { | |||
pub struct AccountSetMemberCursor { | |||
pub member_created_at: chrono::DateTime<chrono::Utc>, | |||
} | |||
|
|||
impl From<chrono::DateTime<chrono::Utc>> for AccountSetMemberCursor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be from a domain type to another not from a primitive. so From<AccountSetMember>
We were comparing
created_at
incala_account_set_member_account_sets
andcala_account_set_member_accounts
with cursor created formcreated_at
incala_account_sets
andcala_accounts
!