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

Ranked stats rough draft #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

redbeardymcgee
Copy link
Contributor

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 defparser and manually testing a call to fetch-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-stats looks 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.clj I have concluded that player-season-ranked-stats-parse essentially just does a fancy call to get-in. It uses the vector value of :from to traverse the nested map and sets the value of each key in season-stats-parse, which again uses a :from [:keys] approach. It appears to not know anything more than the fact that :game-mode-stats is 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-stats key 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.

`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.
@redbeardymcgee
Copy link
Contributor Author

redbeardymcgee commented Oct 7, 2021

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}]}```

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.

1 participant