Replace submitStats query with submitStatsGlobal query for accurate results #109
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#96
Description
Submit stats are incorrect for some specific users. For example with the users with LeetCode usernames
stevenewald
andinfernity25
.Changes Made
The LeetCode API seems to expose two queries for retrieving the submit stats:
submitStats
andsubmitStatsGlobal
as documented here: https://github.com/search?q=repo%3Aakarsh1995%2Fleetcode-graphql-queries%20submitStats&type=code.Replacing the
submitStats
query withsubmitStatsGlobal
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 ifsubmitStats
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."