Skip to content
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: separate leaderboard query on users query #891

Merged
merged 24 commits into from
Jul 21, 2024
Merged

Conversation

ChaituVR
Copy link
Member

@ChaituVR ChaituVR commented Jul 16, 2024

Continued from #886

Summary:

  • Separate query to leaderboard table
  • user query will call users query instead of duplicate code
  • Remove unused filters on users query
  • created can be null

How to test:

Same as #886 (comment)

src/graphql/helpers.ts Outdated Show resolved Hide resolved
@ChaituVR ChaituVR requested a review from wa0x6e July 16, 2024 08:32
@wa0x6e
Copy link
Contributor

wa0x6e commented Jul 16, 2024

Query for single user is not working, always returning the error

{
  "errors": [
    {
      "message": "Cannot return null for non-nullable field User.id.",
      "locations": [
        {
          "line": 3,
          "column": 5
        }
      ],
      "path": [
        "user",
        "id"
      ]
    }
  ],
  "data": {
    "user": null
  }
}

@wa0x6e
Copy link
Contributor

wa0x6e commented Jul 16, 2024

What I meant by possible weird returned results depending on filter is:

query User {
    users(where: {id_in: ["0x0000000007c96AD6c9835204303c8fB35E48Ffc3", "0x2A7e46945277059D57a795CbecDb92DC29db69A6", "0x04DB1bB49b7fFBcEC574f34D29c3153953890352", "0x00Cef6B61fd57d481e569C64Ac5280736023de7F"] }) {
    id
    proposalsCount
    votesCount
  }
}

And

query User {
    users(where: {id_in: ["0x0000000007c96AD6c9835204303c8fB35E48Ffc3", "0x2A7e46945277059D57a795CbecDb92DC29db69A6", "0x04DB1bB49b7fFBcEC574f34D29c3153953890352", "0x00Cef6B61fd57d481e569C64Ac5280736023de7F"], created_lte: 0 }) {
    id
    proposalsCount
    votesCount
  }
}

do not return the same results

@ChaituVR
Copy link
Member Author

It is a different issue, you are using created_lte: 0
which never work somehow, for example try:

query Proposals{
  proposals(first: 10, where:{created_lte:0}) {
    id
    created
  }
}

If you pass a valid value, then it returns correct values, it filters out Users with created null

query User {
    users(where: {id_in: ["0x0000000007c96AD6c9835204303c8fB35E48Ffc3", "0x2A7e46945277059D57a795CbecDb92DC29db69A6", "0x04DB1bB49b7fFBcEC574f34D29c3153953890352", "0x00Cef6B61fd57d481e569C64Ac5280736023de7F"], created_lte: 1651651402 }) {
    id
    proposalsCount
    votesCount
    created
  }
}

@ChaituVR
Copy link
Member Author

Query for single user is not working, always returning the error

Fixed user query, it was due to last minute refactoring 😅

@ChaituVR ChaituVR requested review from wa0x6e and removed request for wa0x6e July 17, 2024 07:34
src/graphql/operations/users.ts Outdated Show resolved Hide resolved
src/graphql/operations/users.ts Show resolved Hide resolved
src/graphql/operations/users.ts Outdated Show resolved Hide resolved
@ChaituVR ChaituVR requested a review from wa0x6e July 20, 2024 08:02
@ChaituVR ChaituVR requested review from wa0x6e and removed request for wa0x6e July 20, 2024 17:39
@wa0x6e wa0x6e changed the title fix: seperate leaderboard query on users query fix: separate leaderboard query on users query Jul 21, 2024
src/graphql/operations/users.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@wa0x6e wa0x6e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tAck

@ChaituVR ChaituVR merged commit c2cdbc5 into master Jul 21, 2024
2 checks passed
@ChaituVR ChaituVR deleted the fix-users-query branch July 21, 2024 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants