football-sources 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,72 +0,0 @@
1
- #### todo/check: move MODS and SCORE_ERRORS out-of-lib
2
- ## and into config or such - why? why not?
3
-
4
-
5
- module Worldfootball
6
-
7
-
8
- ######
9
- # "global" helpers
10
- def self.norm_team( team )
11
- ## clean team name and asciify (e.g. ’->' )
12
- team = team.sub( '(old)', '' ).strip
13
- team = team.gsub( '’', "'" ) ## e.g. Hawke’s Bay United FC
14
- team
15
- end
16
-
17
-
18
-
19
- MODS = {
20
- 'at' => {
21
- ## AT 1
22
- 'SC Magna Wiener Neustadt' => 'SC Wiener Neustadt', # in 2010/11
23
- 'KSV Superfund' => 'Kapfenberger SV', # in 2010/11
24
- 'Kapfenberger SV 1919' => 'Kapfenberger SV', # in 2011/12
25
- 'FC Trenkwalder Admira' => 'FC Admira Wacker', # in 2011/12
26
- ## AT 2
27
- 'Austria Wien (A)' => 'Young Violets', # in 2019/20
28
- 'FC Wacker Innsbruck (A)' => 'FC Wacker Innsbruck II', # in 2018/19
29
- ## AT CUP
30
- 'Rapid Wien (A)' => 'Rapid Wien II', # in 2011/12
31
- 'Sturm Graz (A)' => 'Sturm Graz II',
32
- 'Kapfenberger SV 1919 (A)' => 'Kapfenberger SV II',
33
- 'SV Grödig (A)' => 'SV Grödig II',
34
- 'RB Salzburg (A)' => 'RB Salzburg II',
35
- 'SR WGFM Donaufeld' => 'SR Donaufeld Wien',
36
- 'FC Trenkwalder Admira (A)' => 'FC Admira Wacker II',
37
- ## AT 3.O (Regionalliga Ost)
38
- 'FC Admira Wacker (A)' => 'FC Admira Wacker II', # in 2020/21
39
- },
40
- 'nz' => {
41
- ## NZ 1
42
- 'Wellington Phoenix (R)' => 'Wellington Phoenix Reserves',
43
- },
44
- }
45
-
46
-
47
-
48
- ## fix/patch known score format errors in at/de cups
49
- ## new convention
50
- ## for a fix require league, date, and team1 & team2 for now!!!!
51
- ## - do NOT use some "generic" fix / patch!!!!
52
- ##
53
- ## old de/at patches/fixes:
54
- ## '0-1 (0-0, 0-0, 0-0) n.V.' => '0-1 (0-0, 0-0) n.V.', # too long
55
- ## '2-1 (1-1, 1-1, 1-0) n.V.' => '2-1 (1-1, 1-1) n.V.',
56
- ## '4-2 (0-0, 0-0) i.E.' => '4-2 (0-0, 0-0, 0-0) i.E.', # too short
57
-
58
-
59
- SCORE_ERRORS = {
60
- 'ro.1' => {
61
- ## 2013/14
62
- '2013-07-29' => [ 'FC Brașov', 'Săgeata Năvodari', ['1-1 (0-0, 0-1)', '1-1 (0-0)']],
63
- },
64
- 'gr.1' => {
65
- ## 2010/11
66
- '2010-11-24' => [ 'Ergotelis', 'Olympiakos Piräus', ['0-2 (0-0, 0-0, 0-0)', '0-2 (0-0)']],
67
- '2010-11-28' => [ 'Panserraikos', 'Aris Saloniki', ['1-0 (1-0, 0-0, 0-0)', '1-0 (1-0)']],
68
- }
69
- }
70
-
71
-
72
- end # module Worldfootball
@@ -1,66 +0,0 @@
1
- module Worldfootball
2
-
3
-
4
- MAX_HEADERS = [
5
- 'Stage',
6
- 'Round',
7
- 'Date',
8
- 'Time',
9
- 'Team 1',
10
- 'FT',
11
- 'HT',
12
- 'Team 2',
13
- 'ET',
14
- 'P',
15
- 'Comments'] ## e.g. awarded, cancelled/canceled, etc.
16
-
17
- MIN_HEADERS = [ ## always keep even if all empty
18
- 'Date',
19
- 'Team 1',
20
- 'FT',
21
- 'Team 2'
22
- ]
23
-
24
- def self.vacuum( rows, headers: MAX_HEADERS, fixed_headers: MIN_HEADERS )
25
- ## check for unused columns and strip/remove
26
- counter = Array.new( MAX_HEADERS.size, 0 )
27
- rows.each do |row|
28
- row.each_with_index do |col, idx|
29
- counter[idx] += 1 unless col.nil? || col.empty?
30
- end
31
- end
32
-
33
- pp counter
34
-
35
- ## check empty columns
36
- headers = []
37
- indices = []
38
- empty_headers = []
39
- empty_indices = []
40
-
41
- counter.each_with_index do |num, idx|
42
- header = MAX_HEADERS[ idx ]
43
- if num > 0 || (num == 0 && fixed_headers.include?( header ))
44
- headers << header
45
- indices << idx
46
- else
47
- empty_headers << header
48
- empty_indices << idx
49
- end
50
- end
51
-
52
- if empty_indices.size > 0
53
- rows = rows.map do |row|
54
- row_vacuumed = []
55
- row.each_with_index do |col, idx|
56
- ## todo/fix: use values or such??
57
- row_vacuumed << col unless empty_indices.include?( idx )
58
- end
59
- row_vacuumed
60
- end
61
- end
62
-
63
- [rows, headers]
64
- end
65
-
66
- end # module Worldfootball
@@ -1,19 +0,0 @@
1
- ###########################
2
- # note: split code in two parts
3
- # metal - "bare" basics - no ref to sportdb
4
- # and rest / convert with sportdb references / goodies
5
-
6
-
7
- ## our own code
8
- require_relative 'worldfootball/config'
9
- require_relative 'worldfootball/mods'
10
- require_relative 'worldfootball/vacuum'
11
- require_relative 'worldfootball/build'
12
- require_relative 'worldfootball/convert'
13
- require_relative 'worldfootball/convert_reports'
14
-
15
-
16
- require_relative 'worldfootball/jobs'
17
-
18
-
19
-
data/test/helper.rb DELETED
@@ -1,8 +0,0 @@
1
- $LOAD_PATH.unshift( '../webget/lib')
2
-
3
- require 'minitest/autorun'
4
-
5
-
6
- ## our own code
7
- require 'football/sources' ## or require 'football-sources'
8
-
data/test/test_version.rb DELETED
@@ -1,16 +0,0 @@
1
- ###
2
- # to run use
3
- # ruby -I ./lib -I ./test test/test_version.rb
4
-
5
-
6
- require 'helper'
7
-
8
- class TestVersion < MiniTest::Test
9
-
10
- def test_version
11
- pp FootballSources::VERSION
12
- pp FootballSources.banner
13
- pp FootballSources.root
14
- end
15
-
16
- end # class TestVersion