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

[Bug]: Some games are ranked multiple times #433

Open
p2004a opened this issue Aug 29, 2024 · 1 comment
Open

[Bug]: Some games are ranked multiple times #433

p2004a opened this issue Aug 29, 2024 · 1 comment
Labels
bug Something isn't working medium priority

Comments

@p2004a
Copy link
Contributor

p2004a commented Aug 29, 2024

Describe the Bug

Run into it when I was performing data analysis. There are matches that contain multiple entries in teiserver_game_rating_logs for the same match, for example match_id=2283667 from 2024-03-09. There are 120 games like this, one game is even rated 4 times.

Reproduce the bug

Query to run e.g. on integration server to pull match ids:

WITH
dups AS (
    SELECT
        count(*) AS c,
        match_id,
        user_id
    FROM
        teiserver_game_rating_logs tgrl
    GROUP BY
        match_id,
        user_id
    HAVING
        count(*) > 1
),
dups_per_match AS (
    SELECT
        max(c) AS c,
        match_id
    FROM
        dups
    GROUP BY
        match_id
),
top_dup_matches AS (
    SELECT
        tbm.id,
        tbm.started,
        c AS duplicates
    FROM
        dups_per_match dpm
    JOIN teiserver_battle_matches tbm ON
        dpm.match_id = tbm.id
    ORDER BY
        duplicates DESC,
        tbm.started DESC
)
SELECT
    *
FROM
    top_dup_matches;

Screenshots

No response

Additional context

No response

@p2004a p2004a added the bug Something isn't working label Aug 29, 2024
@L-e-x-o-n
Copy link
Collaborator

As discussed on Discord, constraints should be added so teiserver_game_rating_logs can't contain multiple logs for the same match

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working medium priority
Projects
None yet
Development

No branches or pull requests

2 participants