Because SG-1 has more episodes it will now get a higher chance of being selected

This commit is contained in:
Darren VanBuren 2014-10-02 00:43:36 -07:00
parent dfae73757b
commit 9ef22bca77
2 changed files with 11 additions and 2 deletions

View file

@ -1,6 +1,5 @@
# Holds all our data. We're in another file to make things cleaner. # Holds all our data. We're in another file to make things cleaner.
module StargateRando::Data module StargateRando::Data
SERIES_SHORT_NAMES = ['SG-1', 'SGA', 'SGU']
SERIES_NAMES = { 'SG-1' => 'Stargate SG-1', 'SGA' => 'Stargate Atlantis', SERIES_NAMES = { 'SG-1' => 'Stargate SG-1', 'SGA' => 'Stargate Atlantis',
'SGU' => 'Stargate Universe'} 'SGU' => 'Stargate Universe'}
SEASONS_PER_SERIES = { 'SG-1' => 10, 'SGA' => 5, 'SGU' => 2} SEASONS_PER_SERIES = { 'SG-1' => 10, 'SGA' => 5, 'SGU' => 2}

View file

@ -10,7 +10,17 @@ require './stargaterando-data'
module StargateRando::Controllers module StargateRando::Controllers
class Index < R '/' class Index < R '/'
def get def get
chosen_series_id = Data::SERIES_SHORT_NAMES[rand(3)] series_selector = 1 + rand(17)
p series_selector
case series_selector
when 1..10
chosen_series_id = 'SG-1'
when 11..15
chosen_series_id = 'SGA'
else
chosen_series_id = 'SGU'
end
@series = Data::SERIES_NAMES[chosen_series_id] @series = Data::SERIES_NAMES[chosen_series_id]
num_seasons = Data::SEASONS_PER_SERIES[chosen_series_id] num_seasons = Data::SEASONS_PER_SERIES[chosen_series_id]
chosen_season = 1 + rand(num_seasons) chosen_season = 1 + rand(num_seasons)