Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Playtime appears to be off #228

Open
Double0negative opened this issue Jun 20, 2018 · 1 comment
Open

Playtime appears to be off #228

Double0negative opened this issue Jun 20, 2018 · 1 comment

Comments

@Double0negative
Copy link

Double0negative commented Jun 20, 2018

Issue

The hero playtime being returned from the API appears to be incorrect. For example,

https://owapi.net/api/v3/u/Double0-11909/blob

shows 10hr playtime on hanzo in competitive whereas

https://playoverwatch.com/en-us/career/pc/Double0-11909

shows 14. Widowmaker shows 56hrs in QP whereas playoverwatch shows 58, etc

@jp1337
Copy link
Contributor

jp1337 commented Jul 1, 2018

OWAPI is using a more accurate Platime Calculation than Blizzard is doing on their Website.
Please compare the OWAPI Values with ingame Values.
If you want to use the Calculated Value Blizzard is showing on their Website you can use the "time_played" Value in Quickplay and Competitive Section.
For example Widowmaker: "eu" -> "heroes" -> "stats" -> "quickplay" -> "widowmaker" -> "time_played" is showing 58 which is the Value on the Blizzard Website.

You can see the code for calculating the Hero Playtime here:

    # Loop over each one, extracting the name and hours counted.
    percent_per_second = None
    for child in reversed(hero_info):
        name, played = child.getchildren()
        name, played = util.sanitize_string(name.text), played.text.lower()

        time = 0
        if played != "--":
            time = util.try_extract(played)

        # More accurate playtime calculation
        # Requires reversing hero_info
        category_item = child.getparent().getparent()
        percent = float(category_item.attrib['data-overwatch-progress-percent'])
        if percent_per_second is None and time < 1 and time > 0:
            seconds = 3600 * time
            percent_per_second = percent / seconds

        built_dict[name] = time
        if percent_per_second != None:
            built_dict[name] = (percent / percent_per_second) / float(3600)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants