GetDotaStats / site

The GetDotaStats site in all of its glory
http://getdotastats.com
MIT License
7 stars 2 forks source link

Fix `gameFinished` to actually determine phase #273

Closed jimmydorry closed 8 years ago

jimmydorry commented 8 years ago

https://github.com/GetDotaStats/site/blob/master/site_files/s2/api/s2_phase_3.php#L103-L126

Change to:

    if(isset($preGameAuthPayloadJSON['gameFinished']) && $preGameAuthPayloadJSON['gameFinished'] == 0){
        $gameFinished = 0;
        $matchPhaseSet = 2;
    } else {
        $gameFinished = 1;
        $matchPhaseSet = 3;
    }

    $gameDuration = !empty($preGameAuthPayloadJSON['gameDuration']) && is_numeric($preGameAuthPayloadJSON['gameDuration'])
        ? $preGameAuthPayloadJSON['gameDuration']
        : NULL;

    $sqlResult = $db->q(
        'INSERT INTO `s2_match`(`matchID`, `matchPhaseID`, `matchDuration`, `matchFinished`)
                VALUES (?, ?, ?, ?)
                ON DUPLICATE KEY UPDATE
                  `matchPhaseID` = VALUES(`matchPhaseID`),
                  `matchDuration` = VALUES(`matchDuration`),
                  `matchFinished` = VALUES(`matchFinished`);',
        'siii',
        array(
            $matchID,
            $matchPhaseSet,
            $gameDuration,
            $gameFinished
        )
    );

If they tell us the game is not finished, we will keep them in phase2

jimmydorry commented 8 years ago

Implemented, but not pushed to git.

jimmydorry commented 8 years ago

Did this ages ago. https://github.com/GetDotaStats/site/commit/11eda969971a6ccba487bd404968aca221f5816c