footballdata-api 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/lib/footballdata/convert.rb +19 -11
- data/lib/footballdata/mods.rb +3 -0
- data/lib/footballdata/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5bd4d077f49907b80638105f2152e677540431fee3cee6b9022c48c8a3daadd
|
4
|
+
data.tar.gz: fa80a496acc7e4d3bc2a4095543716c56cf5497b27b994dd173a468ba220b041
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51c7867e5767815a885c9ea7c45df6ae8305bcc74ac8d377ac96de8be9c9577441b5d5fb9c88d40f53af7b0ca1798673cf4c07149291dc6daaa53dd5632be384
|
7
|
+
data.tar.gz: 25a7b9227fe453551d5f76b9a1f0f09c255ffa75e6f3aaa36f7ad5791130ecd42474b0da8c1b5f2f11c915665e601c8749a1ae1ce5efa6920d935d32a403bef7
|
data/CHANGELOG.md
CHANGED
data/lib/footballdata/convert.rb
CHANGED
@@ -38,10 +38,9 @@ STAGES = {
|
|
38
38
|
|
39
39
|
|
40
40
|
|
41
|
-
def self.team_autofill( name, teams: )
|
42
|
-
## note - no country for place holder teams
|
43
|
-
return name if name == 'N.N.'
|
44
41
|
|
42
|
+
|
43
|
+
def self.find_team_country_code( name, teams: )
|
45
44
|
## add (fifa) country code e.g.
|
46
45
|
## Liverpool FC => Liverpool FC (ENG)
|
47
46
|
## or Liverpool FC => Liverpool FC (URU)
|
@@ -59,7 +58,7 @@ def self.team_autofill( name, teams: )
|
|
59
58
|
exit 1
|
60
59
|
end
|
61
60
|
|
62
|
-
|
61
|
+
country.code
|
63
62
|
end
|
64
63
|
|
65
64
|
|
@@ -196,13 +195,6 @@ matches.each do |m|
|
|
196
195
|
teams[ team1 ] += 1
|
197
196
|
teams[ team2 ] += 1
|
198
197
|
|
199
|
-
####
|
200
|
-
# auto-add (fifa) country code if int'l club tournament
|
201
|
-
if clubs_intl
|
202
|
-
team1 = team_autofill( team1, teams: teams_by_name )
|
203
|
-
team2 = team_autofill( team2, teams: teams_by_name )
|
204
|
-
end
|
205
|
-
|
206
198
|
|
207
199
|
### mods - rename club names
|
208
200
|
unless mods.nil? || mods.empty?
|
@@ -210,6 +202,22 @@ matches.each do |m|
|
|
210
202
|
team2 = mods[ team2 ] if mods[ team2 ]
|
211
203
|
end
|
212
204
|
|
205
|
+
####
|
206
|
+
# auto-add (fifa) country code if int'l club tournament
|
207
|
+
if clubs_intl
|
208
|
+
## note - use "original" name (not moded) for lookup
|
209
|
+
team1_org = m['homeTeam']['name']
|
210
|
+
team2_org = m['awayTeam']['name']
|
211
|
+
if team1_org ## note - ignore no team/placeholder (e.g. N.N)
|
212
|
+
country_code = find_team_country_code( team1_org, teams: teams_by_name )
|
213
|
+
team1 = "#{team1} (#{country_code})"
|
214
|
+
end
|
215
|
+
if team2_org ## note - ignore no team/placeholder (e.g. N.N)
|
216
|
+
country_code = find_team_country_code( team2_org, teams: teams_by_name )
|
217
|
+
team2 = "#{team2} (#{country_code})"
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
213
221
|
|
214
222
|
|
215
223
|
comments = ''
|
data/lib/footballdata/mods.rb
CHANGED
@@ -12,6 +12,9 @@ module Footballdata
|
|
12
12
|
'br.1' => {
|
13
13
|
'América FC' => 'América Mineiro', # in year 2018 ??
|
14
14
|
},
|
15
|
+
'copa.l' => {
|
16
|
+
'América FC' => 'América Mineiro', # in year 2022
|
17
|
+
},
|
15
18
|
'pt.1' => {
|
16
19
|
'Vitória SC' => 'Vitória Guimarães', ## avoid easy confusion with Vitória SC <=> Vitória FC
|
17
20
|
'Vitória FC' => 'Vitória Setúbal',
|
data/lib/footballdata/version.rb
CHANGED