leaguewrap icon indicating copy to clipboard operation
leaguewrap copied to clipboard

FeaturedGames tries to use same structure as CurrentGame though the structure is different

Open aleksandrd opened this issue 7 years ago • 1 comments

There is a problem with participants in FeaturedGames. According to Riot API FeaturedGames returns Participant object, while CurrentGame uses CurrentGameParticipant. Main difference is that there is no summonerId in the Participant which causes only 1 last participant being returned in the structure when calling $api->featuredGames()->featuredGames().

To fix this: in CurrentGame.php add check that summonerId is set, otherwise don't use associative array, i.e.:

       foreach ($rawParticipants as $pkey=>$value) {
            $participant = new CurrentGameParticipant($value);

            if (!isset($participant->summonerId)) {
                $participants[] = $participant;
            } else {
                $participants[$participant->summonerId] = $participant;
            }

        }

aleksandrd avatar Jan 09 '17 12:01 aleksandrd

Looks fine. Can you make a pull request from that?

aleksandrd [email protected] schrieb am Mo., 9. Jan. 2017, 13:48:

There is a problem with participants in FeaturedGames. According to Riot API FeaturedGames returns Participant object, while CurrentGame uses CurrentGameParticipant. Main difference is that there is no summonerId in the Participant which causes only 1 last participant being returned in the structure when calling $api->featuredGames()->featuredGames().

To fix this: in CurrentGame.php add check that summonerId is set, otherwise don't use associative array, i.e.:

   foreach ($rawParticipants as $pkey=>$value) {
        $participant = new CurrentGameParticipant($value);

        if (!isset($participant->summonerId)) {
            $participants[] = $participant;
        } else {
            $participants[$participant->summonerId] = $participant;
        }

    }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/paquettg/leaguewrap/issues/130, or mute the thread https://github.com/notifications/unsubscribe-auth/AEeQ8kvTaOnLYCnIFmhWOHcG5p8rwfpBks5rQiyVgaJpZM4LeOUk .

dnlbauer avatar Jan 09 '17 12:01 dnlbauer