sportdb-models 2.0.3 → 2.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 +5 -5
- data/CHANGELOG.md +22 -20
- data/Manifest.txt +0 -4
- data/README.md +28 -31
- data/Rakefile +32 -32
- data/lib/sportdb/models/formats.rb +23 -23
- data/lib/sportdb/models/models/assoc.rb +38 -38
- data/lib/sportdb/models/models/badge.rb +14 -14
- data/lib/sportdb/models/models/forward.rb +55 -55
- data/lib/sportdb/models/models/goal.rb +15 -15
- data/lib/sportdb/models/models/league.rb +20 -20
- data/lib/sportdb/models/models/lineup.rb +20 -17
- data/lib/sportdb/models/models/person.rb +21 -21
- data/lib/sportdb/models/models/season.rb +15 -15
- data/lib/sportdb/models/models/stats/event_standing.rb +31 -31
- data/lib/sportdb/models/models/team.rb +3 -2
- data/lib/sportdb/models/models/world/continent.rb +20 -20
- data/lib/sportdb/models/models/world/state.rb +19 -19
- data/lib/sportdb/models/schema.rb +471 -466
- data/lib/sportdb/models/version.rb +26 -27
- data/lib/sportdb/models.rb +240 -212
- metadata +8 -13
- data/test/helper.rb +0 -46
- data/test/test_changes.rb +0 -78
- data/test/test_cursor.rb +0 -55
- data/test/test_winner.rb +0 -100
@@ -1,31 +1,31 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module SportDb
|
4
|
-
module Model
|
5
|
-
|
6
|
-
|
7
|
-
class EventStanding < ActiveRecord::Base
|
8
|
-
|
9
|
-
self.table_name = 'event_standings'
|
10
|
-
|
11
|
-
has_many :entries, class_name: 'SportDb::Model::EventStandingEntry', foreign_key: 'event_standing_id', :dependent => :delete_all
|
12
|
-
belongs_to :event
|
13
|
-
|
14
|
-
end # class EventStanding
|
15
|
-
|
16
|
-
|
17
|
-
class EventStandingEntry < ActiveRecord::Base
|
18
|
-
|
19
|
-
self.table_name = 'event_standing_entries'
|
20
|
-
|
21
|
-
belongs_to :standing, class_name: 'SportDb::Model::EventStanding', foreign_key: 'event_standing_id'
|
22
|
-
belongs_to :team
|
23
|
-
|
24
|
-
## note:
|
25
|
-
## map standing_id to group_standing_id - convenience alias
|
26
|
-
def standing_id=(value) write_attribute(:event_standing_id, value); end
|
27
|
-
|
28
|
-
end # class EventStandingEntry
|
29
|
-
|
30
|
-
end # module Model
|
31
|
-
end # module SportDb
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module SportDb
|
4
|
+
module Model
|
5
|
+
|
6
|
+
|
7
|
+
class EventStanding < ActiveRecord::Base
|
8
|
+
|
9
|
+
self.table_name = 'event_standings'
|
10
|
+
|
11
|
+
has_many :entries, class_name: 'SportDb::Model::EventStandingEntry', foreign_key: 'event_standing_id', :dependent => :delete_all
|
12
|
+
belongs_to :event
|
13
|
+
|
14
|
+
end # class EventStanding
|
15
|
+
|
16
|
+
|
17
|
+
class EventStandingEntry < ActiveRecord::Base
|
18
|
+
|
19
|
+
self.table_name = 'event_standing_entries'
|
20
|
+
|
21
|
+
belongs_to :standing, class_name: 'SportDb::Model::EventStanding', foreign_key: 'event_standing_id'
|
22
|
+
belongs_to :team
|
23
|
+
|
24
|
+
## note:
|
25
|
+
## map standing_id to group_standing_id - convenience alias
|
26
|
+
def standing_id=(value) write_attribute(:event_standing_id, value); end
|
27
|
+
|
28
|
+
end # class EventStandingEntry
|
29
|
+
|
30
|
+
end # module Model
|
31
|
+
end # module SportDb
|
@@ -16,8 +16,9 @@ class Team < ActiveRecord::Base
|
|
16
16
|
has_many :home_matches, class_name: 'Match', foreign_key: 'team1_id'
|
17
17
|
has_many :away_matches, class_name: 'Match', foreign_key: 'team2_id'
|
18
18
|
|
19
|
-
|
20
|
-
validates :
|
19
|
+
## note: for now allow any key and code
|
20
|
+
## validates :key, format: { with: TEAM_KEY_RE, message: TEAM_KEY_MESSAGE }
|
21
|
+
## validates :code, format: { with: TEAM_CODE_RE, message: TEAM_CODE_MESSAGE }, allow_nil: true
|
21
22
|
|
22
23
|
has_many :event_teams, class_name: 'EventTeam' # join table (events+teams)
|
23
24
|
has_many :events, :through => :event_teams
|
@@ -1,20 +1,20 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module WorldDb
|
4
|
-
module Model
|
5
|
-
|
6
|
-
class Continent
|
7
|
-
has_many :teams, :through => :countries
|
8
|
-
|
9
|
-
# fix: require active record 4
|
10
|
-
# has_many :clubs, :through => :countries
|
11
|
-
# has_many :national_teams, :through => :countries
|
12
|
-
|
13
|
-
|
14
|
-
has_many :leagues, :through => :countries
|
15
|
-
has_many :grounds, :through => :countries
|
16
|
-
end # class Continent
|
17
|
-
|
18
|
-
end # module Model
|
19
|
-
end # module WorldDb
|
20
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module WorldDb
|
4
|
+
module Model
|
5
|
+
|
6
|
+
class Continent
|
7
|
+
has_many :teams, :through => :countries
|
8
|
+
|
9
|
+
# fix: require active record 4
|
10
|
+
# has_many :clubs, :through => :countries
|
11
|
+
# has_many :national_teams, :through => :countries
|
12
|
+
|
13
|
+
|
14
|
+
has_many :leagues, :through => :countries
|
15
|
+
has_many :grounds, :through => :countries
|
16
|
+
end # class Continent
|
17
|
+
|
18
|
+
end # module Model
|
19
|
+
end # module WorldDb
|
20
|
+
|
@@ -1,19 +1,19 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
|
4
|
-
module WorldDb
|
5
|
-
module Model
|
6
|
-
|
7
|
-
class State
|
8
|
-
has_many :teams, class_name: 'SportDb::Model::Team', :through => :cities
|
9
|
-
|
10
|
-
# fix: require active record 4
|
11
|
-
# has_many :clubs, class_name: 'SportDb::Model::Team', :through => :cities
|
12
|
-
# has_many :national_teams, class_name: 'SportDb::Model::Team', :through => :cities
|
13
|
-
|
14
|
-
has_many :grounds, class_name: 'SportDb::Model::Ground', :through => :cities
|
15
|
-
end # class State
|
16
|
-
|
17
|
-
end # module Model
|
18
|
-
end # module WorldDb
|
19
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
|
4
|
+
module WorldDb
|
5
|
+
module Model
|
6
|
+
|
7
|
+
class State
|
8
|
+
has_many :teams, class_name: 'SportDb::Model::Team', :through => :cities
|
9
|
+
|
10
|
+
# fix: require active record 4
|
11
|
+
# has_many :clubs, class_name: 'SportDb::Model::Team', :through => :cities
|
12
|
+
# has_many :national_teams, class_name: 'SportDb::Model::Team', :through => :cities
|
13
|
+
|
14
|
+
has_many :grounds, class_name: 'SportDb::Model::Ground', :through => :cities
|
15
|
+
end # class State
|
16
|
+
|
17
|
+
end # module Model
|
18
|
+
end # module WorldDb
|
19
|
+
|