File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed
Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -33,9 +33,19 @@ def games(self):
3333 return games
3434
3535 def players (self ):
36- players = self .get ('players' )
37- return players
38-
36+ participants = self .get ('participants' )
37+ particing_players = []
38+ for participant in participants :
39+ player = {"id" :participant ['id' ],
40+ "display_name" :participant ['display_name' ],
41+ "twitch_channel" :"" ,
42+ "discord_nick" :""
43+ }
44+ for social in participant ['social_medias' ]:
45+ if social ['platform' ] == 'TWITCH' :
46+ player ['twitch_channel' ] = social ['username' ]
47+ particing_players .append (player )
48+ return particing_players
3949
4050 def donations (self ):
4151 donations = self .get ('donations' )
Original file line number Diff line number Diff line change @@ -25,8 +25,13 @@ def update_timetable(request):
2525 GameInfo .objects .all ().delete ()
2626 for game in games :
2727 api_id = game .pop ('id' )
28- game_players = game .pop ('players' )
28+ if "players" in game :
29+ game .pop ('players' )
30+ game_players = []
2931 game_participants = game .pop ('participants' )
32+ for participant in game_participants :
33+ if participant ['role' ] == "PLAYER" :
34+ game_players .append (participant ['participant_id' ])
3035 game_ , _ = GameInfo .objects .update_or_create (
3136 api_id = api_id ,
3237 defaults = game
You can’t perform that action at this time.
0 commit comments