removed code duplication
This commit is contained in:
parent
8b65b704da
commit
08848ddc5b
|
@ -24,29 +24,23 @@ def show_match(tournament_id, match_id):
|
||||||
participants = list()
|
participants = list()
|
||||||
for opponent in match['opponents']:
|
for opponent in match['opponents']:
|
||||||
participant = toornament.get_participant(tournament_id, opponent['participant']['id'])
|
participant = toornament.get_participant(tournament_id, opponent['participant']['id'])
|
||||||
|
generate_multilink = False
|
||||||
if 'summoner_name' in participant['lineup'][0]['custom_fields']:
|
if 'summoner_name' in participant['lineup'][0]['custom_fields']:
|
||||||
summoner_names = list()
|
generate_multilink = True
|
||||||
for player in participant['lineup']:
|
|
||||||
summoner_names.append(player['custom_fields']['summoner_name'])
|
|
||||||
multilink_params = {
|
|
||||||
'query': ','.join(summoner_names)
|
|
||||||
}
|
|
||||||
participant['opgg_multilink'] = urllib.parse.urlencode(multilink_params)
|
|
||||||
elif 'beschwoerername' in participant['lineup'][0]['custom_fields']:
|
elif 'beschwoerername' in participant['lineup'][0]['custom_fields']:
|
||||||
for idx, _ in enumerate(participant['lineup']):
|
for idx, _ in enumerate(participant['lineup']):
|
||||||
participant['lineup'][idx]['custom_fields']['summoner_name'] = \
|
participant['lineup'][idx]['custom_fields']['summoner_name'] = \
|
||||||
participant['lineup'][0]['custom_fields']
|
participant['lineup'][0]['custom_fields']
|
||||||
summoner_names = list()
|
generate_multilink = True
|
||||||
for player in participant['lineup']:
|
|
||||||
summoner_names.append(player['custom_fields']['summoner_name'])
|
|
||||||
multilink_params = {
|
|
||||||
'query': ','.join(summoner_names)
|
|
||||||
}
|
|
||||||
participant['opgg_multilink'] = urllib.parse.urlencode(multilink_params)
|
|
||||||
elif participant['lineup'][0]['custom_fields'] == {}:
|
elif participant['lineup'][0]['custom_fields'] == {}:
|
||||||
for idx, _ in enumerate(participant['lineup']):
|
for idx, _ in enumerate(participant['lineup']):
|
||||||
participant['lineup'][idx]['custom_fields']['summoner_name'] = \
|
participant['lineup'][idx]['custom_fields']['summoner_name'] = \
|
||||||
participant['lineup'][idx]['name']
|
participant['lineup'][idx]['name']
|
||||||
|
generate_multilink = True
|
||||||
|
else:
|
||||||
|
for idx, _ in enumerate(participant['lineup']):
|
||||||
|
participant['lineup'][idx]['custom_fields']['summoner_name'] = 'N/V'
|
||||||
|
if generate_multilink:
|
||||||
summoner_names = list()
|
summoner_names = list()
|
||||||
for player in participant['lineup']:
|
for player in participant['lineup']:
|
||||||
summoner_names.append(player['custom_fields']['summoner_name'])
|
summoner_names.append(player['custom_fields']['summoner_name'])
|
||||||
|
@ -54,8 +48,5 @@ def show_match(tournament_id, match_id):
|
||||||
'query': ','.join(summoner_names)
|
'query': ','.join(summoner_names)
|
||||||
}
|
}
|
||||||
participant['opgg_multilink'] = urllib.parse.urlencode(multilink_params)
|
participant['opgg_multilink'] = urllib.parse.urlencode(multilink_params)
|
||||||
else:
|
|
||||||
for idx, _ in enumerate(participant['lineup']):
|
|
||||||
participant['lineup'][idx]['custom_fields']['summoner_name'] = 'N/V'
|
|
||||||
participants.append(participant)
|
participants.append(participant)
|
||||||
return render_template('match.html', match=match, participants=participants, tournament=tournament)
|
return render_template('match.html', match=match, participants=participants, tournament=tournament)
|
||||||
|
|
Loading…
Reference in New Issue