sportdb-sync 0.0.1 → 0.1.0
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/lib/sportdb/sync/sync.rb +8 -4
- data/lib/sportdb/sync/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9189544ea7204fc5b6f2f11ee1c73dfc6c052a26
|
4
|
+
data.tar.gz: 22c9e9825e8af300213bdaa222bcf1ee457477fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdb749934627aeca879237a42ba50f7284a8c25eef611208b8aea00f9209655e705dbab01c5ae2a0a7bc51509db2c3ed465a26dfc0c60a12e8e73b6dac26caf6
|
7
|
+
data.tar.gz: 5a4005e89e00f18b339198f545b2fa3402531fcc6e4798399defcbc0d2d42f1c7a79f6757e10e85a2667c77d421883d4f80f976240bfeb5e2d2f02f2d5b85740
|
data/lib/sportdb/sync/sync.rb
CHANGED
@@ -98,18 +98,22 @@ module Sync
|
|
98
98
|
def self.find_or_create( club )
|
99
99
|
rec = SportDb::Model::Team.find_by( title: club.name )
|
100
100
|
if rec.nil?
|
101
|
-
## remove all non-ascii a-z chars
|
102
|
-
key = club.name.downcase.gsub( /[^a-z]/, '' )
|
101
|
+
## check if key is present otherwise generate e.g. remove all non-ascii a-z chars
|
102
|
+
key = club.key || club.name.downcase.gsub( /[^a-z]/, '' )
|
103
103
|
puts "add club: #{key}, #{club.name}, #{club.country.name} (#{club.country.key})"
|
104
104
|
|
105
105
|
attribs = {
|
106
|
-
key:
|
107
|
-
title:
|
106
|
+
key: key,
|
107
|
+
title: club.name,
|
108
108
|
country_id: Country.find_or_create( club.country ).id,
|
109
109
|
club: true,
|
110
110
|
national: false ## check -is default anyway - use - why? why not?
|
111
111
|
## todo/fix: add city if present - why? why not?
|
112
112
|
}
|
113
|
+
|
114
|
+
attribs[:code] = club.code if club.code ## add code (abbreviation) if present
|
115
|
+
|
116
|
+
|
113
117
|
if club.alt_names.empty? == false
|
114
118
|
attribs[:synonyms] = club.alt_names.join('|')
|
115
119
|
end
|
data/lib/sportdb/sync/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sportdb-sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sportdb-clubs
|