Open
Conversation
`api-url` is currently modified to temporarily test without other intrusive changes to calling conventions. Issue cjsauer#2 describes what the main issue seems to be, but fixing this is out of scope of the current goal.
Contributor
Author
|
False alarm. The season ended and changed over while I was working on this PR. Nothing is actually broken -- the ranked stats endpoint just doesn't return any data until the player plays a game I suppose. Unranked endpoint doesn't seem to care whether the player has any match history in the current season. The response now looks like this: #:pubg.player{:id "account.4e4b00<snip>",
:season-ranked-stats
[{:pubg.season.stats/avg-survival-time 0,
:pubg.season.stats/round-most-kills 0,
:pubg.season.stats/deaths 5,
:pubg.season.stats/avg-rank 10.8,
:pubg.season.stats/best-rank-point 1832,
:pubg.season.stats/play-time 0,
:pubg/game-mode "squad-fpp",
:pubg.season.stats/wins 0,
:pubg.season.stats/current-sub-tier "2",
:pubg.season.stats/boosts 0,
:pubg.season.stats/dbnos 6,
:pubg.season.stats/best-tier "Silver",
:pubg.season.stats/assists 0,
:pubg.season.stats/headshot-kills 0,
:pubg.season.stats/current-tier "Silver",
:pubg.season.stats/damage-dealt 1114.0745,
:pubg.season.stats/weapons-acquired 0,
:pubg.season.stats/heals 0,
:pubg.season.stats/top-10-ratio 0.6,
:pubg.season.stats/longest-kill 0,
:pubg.season.stats/win-ratio 0,
:pubg.season.stats/rounds-played 5,
:pubg.season.stats/kda 0.8,
:pubg.season.stats/headshot-kill-ratio 0,
:pubg.season.stats/kills 4,
:pubg.season.stats/kill-streak 0,
:pubg.season.stats/current-rank-point 1832,
:pubg.season.stats/revives 0,
:pubg.season.stats/team-kills 0,
:pubg.season.stats/kdr 0,
:pubg.season.stats/revive-ratio 0}]}``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR revisits #3 without a thrashed commit history or zprint-induced whitespace noise diffs.
I have been trying to get this to work for a couple of hours by stepping through a macroexpansion of
defparserand manually testing a call tofetch-player-season-ranked-stats, but no luck so far. I could use some nudging toward a solution.The standard unranked stats returned by
fetch-player-season-statslooks like this.{:body {:data {:attributes { :game-mode-stats {:duo { :assists 0, :boosts 0, :d-bn-os 0, ...<SNIP>},The ranked endpoint returns this:
{:body {:data {:attributes { :ranked-game-mode-stats {:squad-fpp { :assists 159, :avg-rank 8.719444, :avg-survival-time 0, ...<SNIP>}}},The shape of both structures is identical, which I have emphasized with some effort at alignment. From digging in
parsers.cljI have concluded thatplayer-season-ranked-stats-parseessentially just does a fancy call toget-in. It uses the vector value of:fromto traverse the nested map and sets the value of each key inseason-stats-parse, which again uses a:from [:keys]approach. It appears to not know anything more than the fact that:game-mode-statsis a key to a map containing relevant stats data.Given the fact that the ranked stats data has exactly the same shape, I would expect a first draft implementing ranked stats would be able to safely copy and paste the approach for unranked stats. However, the
:season-ranked-statskey result is just an empty vector. I cannot understand why this happens. I'm traversing an identical data structure with an identical approach, but I capture no data.