djrscally / pubg_reporting

Tools to create and maintain a reporting db syncing to the pubg API
GNU General Public License v3.0
2 stars 1 forks source link

Add player that still had games with others #14

Closed TTAbwill closed 4 years ago

TTAbwill commented 4 years ago

Hey there, its me again ;)

Szenario: I added player A and run the sync. Everything works perfect. Then i added player B who had a match with player A yesterday. Sync works, but:

Issue: The stats of the match player A and B played together is not showing up in player_match_stats for player B.

djrscally commented 4 years ago

Ah, good spot. That one is because...

    process_matches = []

    for player in api.players:
        for match in player['relationships']['matches']['data']:
            q = sess.query(Match).filter_by(match_id=match['id'])
            # If we already added it, or it already exists in the database
            if (match['id'] in process_matches) or (sess.query(q.exists()).one()[0]):
                continue
            else:
                process_matches.append(match['id'])

We only sync matches that don't already exist in the database, because I didn't consider the case of a player who played in a match being added AFTER the sync had run and included that match. I'll tweak it to check if player match stats exist instead of just the raw match, and sync if not.

djrscally commented 4 years ago

@TTAbwill Fixed - pull master for the update. Note that a bunch more optimisation efforts went into master last night too so there's more than just this change.

TTAbwill commented 4 years ago

Still greate work. I'll try. Thank you!

djrscally commented 4 years ago

You're welcome!

On Fri, Feb 28, 2020, 12:16 PM TTAbwill notifications@github.com wrote:

Still greate work. I'll try. Thank you!

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/djrscally/pubg_reporting/issues/14?email_source=notifications&email_token=ABDBE255HER5MXDMKHWQDFLRFD6CHA5CNFSM4K5OVB3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENIKPZI#issuecomment-592488421, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDBE27PNBGK3UFHYTCQ57TRFD6CHANCNFSM4K5OVB3A .