Skip to content

Commit

Permalink
display higher rank types for high ranking players
Browse files Browse the repository at this point in the history
  • Loading branch information
danReynolds committed Apr 2, 2018
1 parent d824beb commit 4b82874
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/summoners_controller.rb
Expand Up @@ -36,7 +36,7 @@ def performance_summary
rank: queue.rank,
winrate: queue.winrate,
hot_streak: queue.hot_streak ? 'on' : 'not on',
elo: queue.elo.humanize,
elo: queue.display_elo.humanize,
queue: queue.name
})

Expand Down
4 changes: 4 additions & 0 deletions app/models/ranked_queue.rb
Expand Up @@ -33,6 +33,10 @@ def elo
ChampionGGApi::ELOS[@queue['tier'].to_sym] rescue nil
end

def display_elo
ChampionGGApi::DISPLAY_ELOS[@queue['tier'].to_sym] rescue nil
end

def lp
@queue['leaguePoints']
end
Expand Down
10 changes: 10 additions & 0 deletions lib/champion_gg_api.rb
Expand Up @@ -14,6 +14,16 @@ class ChampionGGApi < ExternalApi
CHALLENGER: 'PLATINUM_PLUS'
}.freeze

DISPLAY_ELOS = {
BRONZE: 'BRONZE',
SILVER: 'SILVER',
GOLD: 'GOLD',
PLATINUM: 'PLATINUM',
MASTER: 'MASTER',
DIAMOND: 'DIAMOND',
CHALLENGER: 'CHALLENGER'
}.freeze

# Metric Options
# for builds and ability order performance in a role
METRICS = {
Expand Down
6 changes: 6 additions & 0 deletions spec/controllers/summoners_controller_spec.rb
Expand Up @@ -1550,6 +1550,12 @@
expect(speech).to eq 'Wingilote is ranked Gold V with 84 LP in Solo Queue. The summoner currently has a 50.16% win rate.'
end

it 'should use display elos for higher ranked players' do
external_response[0]['tier'] = 'MASTER'
post action, params: params
expect(speech).to eq 'Wingilote is ranked Master V with 84 LP in Solo Queue. The summoner currently has a 50.16% win rate.'
end

it 'should vary the information by queue' do
summoner_params[:queue] = 'RANKED_FLEX_SR'
post action, params: params
Expand Down

0 comments on commit 4b82874

Please sign in to comment.