{"action":"closed","issue":{"url":"https://api.github.com/repos/PennyDreadfulMTG/perf-reports/issues/41641","repository_url":"https://api.github.com/repos/PennyDreadfulMTG/perf-reports","labels_url":"https://api.github.com/repos/PennyDreadfulMTG/perf-reports/issues/41641/labels{/name}","comments_url":"https://api.github.com/repos/PennyDreadfulMTG/perf-reports/issues/41641/comments","events_url":"https://api.github.com/repos/PennyDreadfulMTG/perf-reports/issues/41641/events","html_url":"https://github.com/PennyDreadfulMTG/perf-reports/issues/41641","id":374732613,"node_id":"MDU6SXNzdWUzNzQ3MzI2MTM=","number":41641,"title":"500 error at /api/person/4423/","user":{"login":"vorpal-buildbot","id":23072004,"node_id":"MDQ6VXNlcjIzMDcyMDA0","avatar_url":"https://avatars2.githubusercontent.com/u/23072004?v=4","gravatar_id":"","url":"https://api.github.com/users/vorpal-buildbot","html_url":"https://github.com/vorpal-buildbot","followers_url":"https://api.github.com/users/vorpal-buildbot/followers","following_url":"https://api.github.com/users/vorpal-buildbot/following{/other_user}","gists_url":"https://api.github.com/users/vorpal-buildbot/gists{/gist_id}","starred_url":"https://api.github.com/users/vorpal-buildbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vorpal-buildbot/subscriptions","organizations_url":"https://api.github.com/users/vorpal-buildbot/orgs","repos_url":"https://api.github.com/users/vorpal-buildbot/repos","events_url":"https://api.github.com/users/vorpal-buildbot/events{/privacy}","received_events_url":"https://api.github.com/users/vorpal-buildbot/received_events","type":"User","site_admin":false},"labels":[{"id":958792190,"node_id":"MDU6TGFiZWw5NTg3OTIxOTA=","url":"https://api.github.com/repos/PennyDreadfulMTG/perf-reports/labels/DatabaseException","name":"DatabaseException","color":"b60205","default":false},{"id":958792189,"node_id":"MDU6TGFiZWw5NTg3OTIxODk=","url":"https://api.github.com/repos/PennyDreadfulMTG/perf-reports/labels/decksite","name":"decksite","color":"bfd4f2","default":false},{"id":763867617,"node_id":"MDU6TGFiZWw3NjM4Njc2MTc=","url":"https://api.github.com/repos/PennyDreadfulMTG/perf-reports/labels/wontfix","name":"wontfix","color":"ffffff","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-28T09:04:07Z","updated_at":"2019-01-03T16:04:56Z","closed_at":"2019-01-03T16:04:56Z","author_association":"NONE","body":" Failed to execute `\n        SELECT\n            p.id,\n            LOWER(IFNULL(IFNULL(IFNULL(p.name, p.mtgo_username), p.mtggoldfish_username), p.tappedout_username)) AS name,\n            p.mtgo_username,\n            p.tappedout_username,\n            p.mtggoldfish_username,\n            p.discord_id,\n            p.elo,\n            num_decks,\n            wins,\n            losses,\n            draws,\n            perfect_runs,\n            tournament_wins,\n            tournament_top8s,\n            win_percent,\n            num_competitions\n        FROM\n            person AS p\n        LEFT JOIN\n            (\n                SELECT\n                    d.person_id,\n                    COUNT(d.id) AS num_decks,\n                    SUM(wins) AS wins,\n                    SUM(losses) AS losses,\n                    SUM(draws) AS draws,\n                    SUM(CASE WHEN wins >= 5 AND losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,\n                    SUM(CASE WHEN d.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,\n                    SUM(CASE WHEN d.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,\n                    IFNULL(ROUND((SUM(wins) / NULLIF(SUM(wins + losses), 0)) * 100, 1), '') AS win_percent,\n                    SUM(DISTINCT CASE WHEN d.competition_id IS NOT NULL THEN 1 ELSE 0 END) AS num_competitions\n                FROM\n                    deck AS d\n                LEFT JOIN\n                    deck_cache AS dc ON d.id = dc.deck_id\n                \n        LEFT JOIN\n            (\n                SELECT\n                    `start`.id,\n                    `start`.code,\n                    `start`.start_date AS start_date,\n                    `end`.start_date AS end_date\n                FROM\n                    season AS `start`\n                LEFT JOIN\n                    season AS `end` ON `end`.id = `start`.id + 1\n            ) AS season ON season.start_date <= d.created_date AND (season.end_date IS NULL OR season.end_date > d.created_date)\n    \n                WHERE\n                    TRUE\n                GROUP BY\n                    d.person_id\n            ) AS stats ON p.id = stats.person_id\n        WHERE\n            p.mtgo_username = 4423\n        GROUP BY\n            p.id\n        ORDER BY\n            `num_decks` DESC, name\n    ` with `[]` because of `(1292, \"Truncated incorrect DOUBLE value: 'Daviajagunan'\")`\n\nReported on decksite by logged_out```\n            --------------------------------------------------------------------------------\n            Request Method: GET\n            Path: /api/person/4423/?\n            Cookies: {'__cfduid': 'd55ba902b50dd7cb327f7e93a4b3f46be1540717446'}\n            Endpoint: person_api\n            View Args: {'person': '4423'}\n            Person: logged_out\n            Referrer: None\n            Request Data: {}\nHost: pennydreadfulmagic.com\nAccept-Encoding: gzip\nCf-Ipcountry: XX\nX-Forwarded-For: 35.205.164.196, 141.101.69.89\nCf-Ray: 470c3ba91e20a863-CDG\nX-Forwarded-Proto: https\nCf-Visitor: {\"scheme\":\"https\"}\nCookie: __cfduid=d55ba902b50dd7cb327f7e93a4b3f46be1540717446\nCf-Connecting-Ip: 35.205.164.196\nX-Forwarded-Host: pennydreadfulmagic.com\nX-Forwarded-Server: pennydreadfulmagic.com\nConnection: Keep-Alive\n```\n--------------------------------------------------------------------------------\nDatabaseException\nFailed to execute `\n        SELECT\n            p.id,\n            LOWER(IFNULL(IFNULL(IFNULL(p.name, p.mtgo_username), p.mtggoldfish_username), p.tappedout_username)) AS name,\n            p.mtgo_username,\n            p.tappedout_username,\n            p.mtggoldfish_username,\n            p.discord_id,\n            p.elo,\n            num_decks,\n            wins,\n            losses,\n            draws,\n            perfect_runs,\n            tournament_wins,\n            tournament_top8s,\n            win_percent,\n            num_competitions\n        FROM\n            person AS p\n        LEFT JOIN\n            (\n                SELECT\n                    d.person_id,\n                    COUNT(d.id) AS num_decks,\n                    SUM(wins) AS wins,\n                    SUM(losses) AS losses,\n                    SUM(draws) AS draws,\n                    SUM(CASE WHEN wins >= 5 AND losses = 0 AND d.source_id IN (SELECT id FROM source WHERE name = 'League') THEN 1 ELSE 0 END) AS perfect_runs,\n                    SUM(CASE WHEN d.finish = 1 THEN 1 ELSE 0 END) AS tournament_wins,\n                    SUM(CASE WHEN d.finish <= 8 THEN 1 ELSE 0 END) AS tournament_top8s,\n                    IFNULL(ROUND((SUM(wins) / NULLIF(SUM(wins + losses), 0)) * 100, 1), '') AS win_percent,\n                    SUM(DISTINCT CASE WHEN d.competition_id IS NOT NULL THEN 1 ELSE 0 END) AS num_competitions\n                FROM\n                    deck AS d\n                LEFT JOIN\n                    deck_cache AS dc ON d.id = dc.deck_id\n                \n        LEFT JOIN\n            (\n                SELECT\n                    `start`.id,\n                    `start`.code,\n                    `start`.start_date AS start_date,\n                    `end`.start_date AS end_date\n                FROM\n                    season AS `start`\n                LEFT JOIN\n                    season AS `end` ON `end`.id = `start`.id + 1\n            ) AS season ON season.start_date <= d.created_date AND (season.end_date IS NULL OR season.end_date > d.created_date)\n    \n                WHERE\n                    TRUE\n                GROUP BY\n                    d.person_id\n            ) AS stats ON p.id = stats.person_id\n        WHERE\n            p.mtgo_username = 4423\n        GROUP BY\n            p.id\n        ORDER BY\n            `num_decks` DESC, name\n    ` with `[]` because of `(1292, \"Truncated incorrect DOUBLE value: 'Daviajagunan'\")`\nStack Trace:\n```\n  File \"/home/discord/.local/lib/python3.6/site-packages/flask/app.py\", line 2309, in __call__\n    return self.wsgi_app(environ, start_response)\n  File \"/home/discord/.local/lib/python3.6/site-packages/flask/app.py\", line 2295, in wsgi_app\n    response = self.handle_exception(e)\n  File \"/home/discord/.local/lib/python3.6/site-packages/flask/app.py\", line 2292, in wsgi_app\n    response = self.full_dispatch_request()\n  File \"/home/discord/.local/lib/python3.6/site-packages/flask/app.py\", line 1815, in full_dispatch_request\n    rv = self.handle_user_exception(e)\n  File \"/home/discord/.local/lib/python3.6/site-packages/flask/app.py\", line 1718, in handle_user_exception\n    reraise(exc_type, exc_value, tb)\n  File \"/home/discord/.local/lib/python3.6/site-packages/flask/_compat.py\", line 35, in reraise\n    raise value\n  File \"/home/discord/.local/lib/python3.6/site-packages/flask/app.py\", line 1813, in full_dispatch_request\n    rv = self.dispatch_request()\n  File \"/home/discord/.local/lib/python3.6/site-packages/flask/app.py\", line 1799, in dispatch_request\n    return self.view_functions[rule.endpoint](**req.view_args)\n  File \"./decksite/api.py\", line 56, in person_api\n    p = ps.load_person_by_discord_id_or_username(person)\n  File \"./decksite/data/person.py\", line 64, in load_person_by_discord_id_or_username\n    return load_person_by_mtgo_username(person)\n  File \"./decksite/data/person.py\", line 26, in load_person_by_mtgo_username\n    return load_person('p.mtgo_username = {username}'.format(username=sqlescape(username)), season_id=season_id)\n  File \"./decksite/data/person.py\", line 81, in load_person\n    person = guarantee.exactly_one(load_people(where, season_id=season_id))\n  File \"./decksite/data/person.py\", line 139, in load_people\n    people = [Person(r) for r in db().select(sql)]\n  File \"./shared/database.py\", line 41, in select\n    [_, rows] = self.execute_anything(sql, args)\n  File \"./shared/database.py\", line 58, in execute_anything\n    raise DatabaseException('Failed to execute `{sql}` with `{args}` because of `{e}`'.format(sql=sql, args=args, e=e))\n\n```\n"}}
{"actor":{"display_login":"stale"}}