lib/sportdb/reader.rb in sportdb-1.8.2 vs lib/sportdb/reader.rb in sportdb-1.8.3
- old
+ new
@@ -105,13 +105,14 @@
# e.g. at/leagues
country = Country.find_by_key!( country_key )
load_leagues( name, club: true, country_id: country.id )
end
elsif name =~ /(?:^|\/)leagues/ # NB: ^leagues or also possible world!/leagues - NB: make sure goes after leagues_for_country!!
- if name =~ /-cup!?\// # NB: -cup/ or -cup!/
+ if name =~ /-cup!?\// || # NB: -cup/ or -cup!/
+ name =~ /copa-america!?\// # NB: copa-america/ or copa-america!/
# e.g. national team tournaments/leagues (e.g. world-cup/ or euro-cup/)
- load_leagues( name )
+ load_leagues( name, club: false )
else
# e.g. leagues_club
load_leagues( name, club: true )
end
elsif match_teams_for_country( name ) do |country_key| # name =~ /^([a-z]{2})\/teams/
@@ -119,13 +120,14 @@
# e.g. at/teams at/teams.2 de/teams etc.
country = Country.find_by_key!( country_key )
load_teams( name, club: true, country_id: country.id )
end
elsif name =~ /(?:^|\/)teams/
- if name =~ /-cup!?\// # NB: -cup/ or -cup!/
+ if name =~ /-cup!?\// || # NB: -cup/ or -cup!/
+ name =~ /copa-america!?\// # NB: copa-america/ or copa-america!/
# assume national teams
# e.g. world-cup/teams amercia-cup/teams_northern
- load_teams( name, national: true )
+ load_teams( name, club: false )
else
# club teams (many countries)
# e.g. club/europe/teams
load_teams( name, club: true )
end