sportdb-play 0.2.2 → 0.2.3
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.
- data/lib/sportdb/play/models/bonus_point.rb +8 -6
- data/lib/sportdb/play/models/bonus_question.rb +6 -4
- data/lib/sportdb/play/models/bonus_round.rb +6 -4
- data/lib/sportdb/play/models/bonus_tip.rb +5 -3
- data/lib/sportdb/play/models/game.rb +7 -13
- data/lib/sportdb/play/models/play.rb +14 -16
- data/lib/sportdb/play/models/point.rb +5 -3
- data/lib/sportdb/play/models/pool.rb +5 -3
- data/lib/sportdb/play/models/tip.rb +18 -49
- data/lib/sportdb/play/models/user.rb +5 -3
- data/lib/sportdb/play/schema.rb +5 -3
- data/lib/sportdb/play/version.rb +4 -4
- data/lib/sportdb/play.rb +5 -3
- metadata +11 -9
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
## NB: just use namespace SportDb::
|
|
2
|
+
## NB: just use namespace SportDb::Model (not SportDb::Model::Play)
|
|
3
3
|
|
|
4
|
-
module SportDb
|
|
4
|
+
module SportDb
|
|
5
|
+
module Model
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
class BonusPoint < ActiveRecord::Base
|
|
8
|
-
|
|
9
|
+
|
|
9
10
|
belongs_to :user
|
|
10
11
|
belongs_to :pool
|
|
11
|
-
belongs_to :round, :
|
|
12
|
-
|
|
12
|
+
belongs_to :round, class_name: 'BonusRound', foreign_key: 'round_id'
|
|
13
|
+
|
|
13
14
|
end # class BonusPoint
|
|
14
15
|
|
|
16
|
+
end # module Model
|
|
17
|
+
end # module SportDb
|
|
15
18
|
|
|
16
|
-
end # module SportDb::Models
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
## NB: just use namespace SportDb::
|
|
2
|
+
## NB: just use namespace SportDb::Model (not SportDb::Model::Play)
|
|
3
3
|
|
|
4
|
-
module SportDb
|
|
4
|
+
module SportDb
|
|
5
|
+
module Model
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
class BonusQuestion < ActiveRecord::Base
|
|
8
9
|
|
|
9
10
|
self.table_name = 'bonus_questions'
|
|
10
11
|
|
|
11
|
-
has_many :tips, :
|
|
12
|
+
has_many :tips, class_name: 'BonusTip', foreign_key: 'question_id'
|
|
12
13
|
|
|
13
14
|
end # class BonusQuestion
|
|
14
15
|
|
|
16
|
+
end # module Model
|
|
17
|
+
end # module SportDb
|
|
15
18
|
|
|
16
|
-
end # module SportDb::Models
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
## NB: just use namespace SportDb::
|
|
2
|
+
## NB: just use namespace SportDb::Model (not SportDb::Model::Play)
|
|
3
3
|
|
|
4
|
-
module SportDb
|
|
4
|
+
module SportDb
|
|
5
|
+
module Model
|
|
5
6
|
|
|
6
7
|
class BonusRound < ActiveRecord::Base
|
|
7
8
|
|
|
8
9
|
self.table_name = 'bonus_rounds'
|
|
9
10
|
|
|
10
|
-
has_many :questions, :
|
|
11
|
+
has_many :questions, order: 'pos', class_name: 'BonusQuestion', foreign_key: 'round_id'
|
|
11
12
|
belongs_to :pool
|
|
12
13
|
|
|
13
14
|
end # class BonusRound
|
|
14
15
|
|
|
15
|
-
end
|
|
16
|
+
end # module Model
|
|
17
|
+
end # module SportDb
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
## NB: just use namespace SportDb::
|
|
2
|
+
## NB: just use namespace SportDb::Model (not SportDb::Model::Play)
|
|
3
3
|
|
|
4
|
-
module SportDb
|
|
4
|
+
module SportDb
|
|
5
|
+
module Model
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
class BonusTip < ActiveRecord::Base
|
|
@@ -13,5 +14,6 @@ class BonusTip < ActiveRecord::Base
|
|
|
13
14
|
end # class BonusTip
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
end # module
|
|
17
|
+
end # module Model
|
|
18
|
+
end # module SportDb
|
|
17
19
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
module SportDb
|
|
4
|
+
module SportDb
|
|
5
|
+
module Model
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
### NB: extend Game model from sport.db gem
|
|
@@ -33,17 +34,9 @@ class Game
|
|
|
33
34
|
## keep style helpers here? why? why not?
|
|
34
35
|
|
|
35
36
|
|
|
36
|
-
def tip_1_style_class
|
|
37
|
-
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def tip_2_style_class
|
|
41
|
-
toto1x2 == '2' ? ' bingo ' : ' '
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def tip_x_style_class
|
|
45
|
-
toto1x2 == 'X' ? ' bingo ' : ' '
|
|
46
|
-
end
|
|
37
|
+
def tip_1_style_class() toto1x2 == '1' ? ' bingo ' : ' '; end
|
|
38
|
+
def tip_2_style_class() toto1x2 == '2' ? ' bingo ' : ' '; end
|
|
39
|
+
def tip_x_style_class() toto1x2 == 'X' ? ' bingo ' : ' '; end
|
|
47
40
|
|
|
48
41
|
|
|
49
42
|
############ some methods for stats
|
|
@@ -66,4 +59,5 @@ class Game
|
|
|
66
59
|
end # class Game
|
|
67
60
|
|
|
68
61
|
|
|
69
|
-
end # module
|
|
62
|
+
end # module Model
|
|
63
|
+
end # module SportDb
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
|
|
2
|
-
## NB: just use namespace SportDb::
|
|
2
|
+
## NB: just use namespace SportDb::Model (not SportDb::Model::Play)
|
|
3
|
+
|
|
4
|
+
module SportDb
|
|
5
|
+
module Model
|
|
3
6
|
|
|
4
|
-
module SportDb::Models
|
|
5
7
|
|
|
6
8
|
class Play < ActiveRecord::Base
|
|
7
|
-
|
|
9
|
+
|
|
8
10
|
belongs_to :user
|
|
9
11
|
belongs_to :pool
|
|
10
|
-
|
|
11
|
-
belongs_to :team1, :class_name => 'Team', :foreign_key => 'team1_id'
|
|
12
|
-
belongs_to :team2, :class_name => 'Team', :foreign_key => 'team2_id'
|
|
13
|
-
belongs_to :team3, :class_name => 'Team', :foreign_key => 'team3_id'
|
|
14
|
-
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
end
|
|
13
|
+
belongs_to :team1, class_name: 'Team', foreign_key: 'team1_id'
|
|
14
|
+
belongs_to :team2, class_name: 'Team', foreign_key: 'team2_id'
|
|
15
|
+
belongs_to :team3, class_name: 'Team', foreign_key: 'team3_id'
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def job_running!() @job_running = true; end
|
|
19
|
+
def job_done!() @job_running = false; end
|
|
23
20
|
|
|
24
21
|
def job_running?
|
|
25
22
|
(@job_running ||= false) == true
|
|
@@ -58,4 +55,5 @@ class Play < ActiveRecord::Base
|
|
|
58
55
|
end # class Play
|
|
59
56
|
|
|
60
57
|
|
|
61
|
-
end
|
|
58
|
+
end # module Model
|
|
59
|
+
end # module SportDb
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
|
-
## NB: just use namespace SportDb::
|
|
3
|
+
## NB: just use namespace SportDb::Model (not SportDb::Model::Play)
|
|
4
4
|
|
|
5
|
-
module SportDb
|
|
5
|
+
module SportDb
|
|
6
|
+
module Model
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class Point < ActiveRecord::Base
|
|
@@ -51,5 +52,6 @@ class Point < ActiveRecord::Base
|
|
|
51
52
|
|
|
52
53
|
end # class Point
|
|
53
54
|
|
|
55
|
+
end # module Model
|
|
56
|
+
end # module SportDb
|
|
54
57
|
|
|
55
|
-
end # module SportDb::Models
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
|
-
## NB: just use namespace SportDb::
|
|
3
|
+
## NB: just use namespace SportDb::Model (not SportDb::Model::Play)
|
|
4
4
|
|
|
5
|
-
module SportDb
|
|
5
|
+
module SportDb
|
|
6
|
+
module Model
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class Pool < ActiveRecord::Base
|
|
@@ -32,5 +33,6 @@ class Pool < ActiveRecord::Base
|
|
|
32
33
|
end # class Pool
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
end
|
|
36
|
+
end # module Model
|
|
37
|
+
end # module SportDb
|
|
36
38
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
## NB: just use namespace SportDb::
|
|
4
|
+
## NB: just use namespace SportDb::Model (not SportDb::Model::Play)
|
|
5
5
|
|
|
6
|
-
module SportDb
|
|
6
|
+
module SportDb
|
|
7
|
+
module Model
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
class Tip < ActiveRecord::Base
|
|
@@ -95,53 +96,19 @@ class Tip < ActiveRecord::Base
|
|
|
95
96
|
|
|
96
97
|
### getter/setters for deprecated attribs (score3,4,5,6)
|
|
97
98
|
|
|
98
|
-
def score3
|
|
99
|
-
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def
|
|
103
|
-
|
|
104
|
-
end
|
|
99
|
+
def score3() score1et; end
|
|
100
|
+
def score4() score2et; end
|
|
101
|
+
def score1ot() score1et; end
|
|
102
|
+
def score2ot() score2et; end
|
|
103
|
+
def score5() score1p; end
|
|
104
|
+
def score6() score2p; end
|
|
105
105
|
|
|
106
|
-
def
|
|
107
|
-
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
def
|
|
111
|
-
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
def score5
|
|
115
|
-
score1p
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
def score6
|
|
119
|
-
score2p
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
def score3=(value)
|
|
123
|
-
self.score1et = value
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
def score4=(value)
|
|
127
|
-
self.score2et = value
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
def score1ot=(value)
|
|
131
|
-
self.score1et = value
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
def score2ot=(value)
|
|
135
|
-
self.score2et = value
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
def score5=(value)
|
|
139
|
-
self.score1p = value
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
def score6=(value)
|
|
143
|
-
self.score2p = value
|
|
144
|
-
end
|
|
106
|
+
def score3=(value) self.score1et = value; end
|
|
107
|
+
def score4=(value) self.score2et = value; end
|
|
108
|
+
def score1ot=(value) self.score1et = value; end
|
|
109
|
+
def score2ot=(value) self.score2et = value; end
|
|
110
|
+
def score5=(value) self.score1p = value; end
|
|
111
|
+
def score6=(value) self.score2p = value; end
|
|
145
112
|
|
|
146
113
|
|
|
147
114
|
|
|
@@ -375,4 +342,6 @@ class Tip < ActiveRecord::Base
|
|
|
375
342
|
|
|
376
343
|
end # class Tip
|
|
377
344
|
|
|
378
|
-
end
|
|
345
|
+
end # module Model
|
|
346
|
+
end # module SportDb
|
|
347
|
+
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
## NB: just use namespace SportDb::
|
|
4
|
+
## NB: just use namespace SportDb::Model (not SportDb::Model::Play)
|
|
5
5
|
|
|
6
|
-
module SportDb
|
|
6
|
+
module SportDb
|
|
7
|
+
module Model
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
class User < ActiveRecord::Base
|
|
@@ -15,4 +16,5 @@ class User < ActiveRecord::Base
|
|
|
15
16
|
|
|
16
17
|
end # class User
|
|
17
18
|
|
|
18
|
-
end
|
|
19
|
+
end # module Model
|
|
20
|
+
end # module SportDb
|
data/lib/sportdb/play/schema.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
module SportDb
|
|
1
|
+
module SportDb
|
|
2
|
+
module Play
|
|
2
3
|
|
|
3
4
|
class CreateDb < ActiveRecord::Migration
|
|
4
5
|
|
|
@@ -8,7 +9,7 @@ def up
|
|
|
8
9
|
## lets add a check? why? why not?
|
|
9
10
|
|
|
10
11
|
change_table :games do |t|
|
|
11
|
-
t.boolean :locked,
|
|
12
|
+
t.boolean :locked, null: false, default: false
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
|
|
@@ -146,5 +147,6 @@ end
|
|
|
146
147
|
|
|
147
148
|
end # class CreateDb
|
|
148
149
|
|
|
150
|
+
end # module Play
|
|
151
|
+
end # module SportDb
|
|
149
152
|
|
|
150
|
-
end # module SportDb::Play
|
data/lib/sportdb/play/version.rb
CHANGED
data/lib/sportdb/play.rb
CHANGED
|
@@ -17,7 +17,8 @@ require 'sportdb/play/models/tip'
|
|
|
17
17
|
require 'sportdb/play/models/user'
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
module SportDb
|
|
20
|
+
module SportDb
|
|
21
|
+
module Play
|
|
21
22
|
|
|
22
23
|
def self.banner
|
|
23
24
|
"sportdb-play/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
|
@@ -30,10 +31,11 @@ module SportDb::Play
|
|
|
30
31
|
|
|
31
32
|
def self.create
|
|
32
33
|
CreateDb.new.up
|
|
33
|
-
WorldDb::
|
|
34
|
+
WorldDb::Model::Prop.create!( key: 'db.schema.sport.play.version', value: VERSION )
|
|
34
35
|
end
|
|
35
36
|
|
|
36
|
-
end
|
|
37
|
+
end # module Play
|
|
38
|
+
end # module SportDb
|
|
37
39
|
|
|
38
40
|
|
|
39
41
|
## say hello
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sportdb-play
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,36 +9,38 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2014-02-18 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rdoc
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &20807832 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ~>
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: '
|
|
21
|
+
version: '4.0'
|
|
22
22
|
type: :development
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *20807832
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: hoe
|
|
27
|
-
requirement: &
|
|
27
|
+
requirement: &20799360 !ruby/object:Gem::Requirement
|
|
28
28
|
none: false
|
|
29
29
|
requirements:
|
|
30
30
|
- - ~>
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '3.
|
|
32
|
+
version: '3.7'
|
|
33
33
|
type: :development
|
|
34
34
|
prerelease: false
|
|
35
|
-
version_requirements: *
|
|
35
|
+
version_requirements: *20799360
|
|
36
36
|
description: sportdb plugin for plays (predictions, betting pool, etc.)
|
|
37
37
|
email: opensport@googlegroups.com
|
|
38
38
|
executables: []
|
|
39
39
|
extensions: []
|
|
40
40
|
extra_rdoc_files:
|
|
41
|
+
- History.md
|
|
41
42
|
- Manifest.txt
|
|
43
|
+
- README.md
|
|
42
44
|
files:
|
|
43
45
|
- History.md
|
|
44
46
|
- Manifest.txt
|
|
@@ -80,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
80
82
|
version: '0'
|
|
81
83
|
requirements: []
|
|
82
84
|
rubyforge_project: sportdb-play
|
|
83
|
-
rubygems_version: 1.8.
|
|
85
|
+
rubygems_version: 1.8.16
|
|
84
86
|
signing_key:
|
|
85
87
|
specification_version: 3
|
|
86
88
|
summary: sportdb plugin for plays (predictions, betting pool, etc.)
|