Ranked stats rough draft #4
Open
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.