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

Replace submitStats query with submitStatsGlobal query for accurate results #109

Merged
merged 1 commit into from
Jan 7, 2024

Conversation

Kevin-Roman
Copy link
Contributor

@Kevin-Roman Kevin-Roman commented Jan 3, 2024

#96

Description

Submit stats are incorrect for some specific users. For example with the users with LeetCode usernames stevenewald and infernity25.

Changes Made

The LeetCode API seems to expose two queries for retrieving the submit stats: submitStats and submitStatsGlobal as documented here: https://github.com/search?q=repo%3Aakarsh1995%2Fleetcode-graphql-queries%20submitStats&type=code.

Replacing the submitStats query with submitStatsGlobal seems to now be displaying the correct submit stats value for the example above, but also for other usernames that previously also worked. Ideally, a test should be made to test a username that normally doesn't display the correct submit stats if submitStats query is used.

Notes

Personally, I don't know what the difference between these two queries is (other than the difference in results) or why submitStats doesn't retrieve the correct count for each question difficulty. And I haven't yet done the research to figure this out.

Edit:
Thanks to Discord user Infernity25: "It seems submitStats only pulls from the current session, while subStatsGlobal probably pulls data from ALL sessions. I tried switching my sessions within LC and saw results that corresponded with the session stats."

Copy link

changeset-bot bot commented Jan 3, 2024

⚠️ No Changeset found

Latest commit: 0836a73

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@jaipatel248 jaipatel248 mentioned this pull request Jan 6, 2024
@jaipatel248
Copy link

Thanks for opening the PR for this issue.

I have 691 total solved problems but it shows 45 in the card.

The reason is in the API, submitStats fetches only the current active session's stats.

@JacobLinCool JacobLinCool self-requested a review January 7, 2024 08:06
Copy link
Owner

@JacobLinCool JacobLinCool left a comment

Choose a reason for hiding this comment

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

LGTM

@JacobLinCool
Copy link
Owner

Thank you, @Kevin-Roman. It fixes the problem of #96!

@JacobLinCool JacobLinCool linked an issue Jan 7, 2024 that may be closed by this pull request
@JacobLinCool JacobLinCool merged commit 6bca638 into JacobLinCool:main Jan 7, 2024
2 checks passed
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.

Incorrect results
3 participants