question

Benjamin Golinvaux avatar image
Benjamin Golinvaux asked

Different values returned for stats based on primary stat or through ShowStatistics

Hello

We are using GetLeaderboardAroundPlayer and also enabling Request.ProfileConstraints->ShowStatistics in the request, as instructed by someone from PlayFab (here or in Discord, I cant recall, sorry)

What we are noticing is that, even though *most* of the stats are correct, for some specific stats, the results that we receive through the StatName/StatValue in the main result are different from the ones supplied in the Profile->Statistics "side" values.

For instance, we sort leaderboards based on stat A and enable ShowStatistics. We receive A = 20 and B = 8
However, checking in the web portal, we can see that B should be 70

If we instead as for the leaderboard on stat B (and also enable ShowStatistics), then we receive the current correct value for B = 70

The strangest of it all is that the incorrect values that we are seeing for B were the ones from more than two weeks ago! (we are only using stats with the "Sum" aggregation type btw)

Are there known pitfalls when using ShowStatistics? I know it sounds a bit beta based on the header comment (it says "Reserved for future development") but you guys seemed to be confident.

The alternative is to loop on all players * all stats from the leaderboard and this will probably throttle like crazy.

Thanks in advance for your help

Leaderboards and Statistics
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Gosen Gao avatar image
Gosen Gao answered

API GetLeaderboardAroundPlayer will return the current and previous version of statistic. For example, you can see there are two versions of HighScore below. Would you please check the version of the statistic to see if it is the correct version?

"Statistics": [
        {
          "Name": "Level",
          "Version": 0,
          "Value": 8
        },
        {
          "Name": "HighScore",
          "Version": 69,
          "Value": 1
        },
        {
          "Name": "Level",
          "Version": 1,
          "Value": 1
        },
        {
          "Name": "HighScore",
          "Version": 70,
          "Value": 20
        }
]

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Benjamin Golinvaux avatar image
Benjamin Golinvaux answered

You're right ! That was it. I did not expect this and the code did not cope well with multiple values. Thanks a lot.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.