sportdb-play 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.md CHANGED
@@ -1,3 +1,4 @@
1
1
  ### 0.1.0 / 2012-12-03
2
2
 
3
- * Everything is new. First release
3
+ * Everything is new. First release.
4
+
data/README.md CHANGED
@@ -3,6 +3,16 @@
3
3
  Open sports database (sport.db) plugin for plays (predictions,
4
4
  betting pools, etc.)
5
5
 
6
+ https://github.com/openbookie/sport.db.play
7
+
8
+ * home :: [github.com/openbookie/sport.db.play](https://github.com/openbookie/sport.db.play)
9
+ * bugs :: [github.com/openbookie/sport.db.play/issues](https://github.com/openbookie/sport.db.play/issues)
10
+ * gem :: [rubygems.org/gems/sportdb-play](https://rubygems.org/gems/sportdb-play)
11
+ * rdoc :: [rubydoc.info/gems/sportdb-play](http://rubydoc.info/gems/sportdb-play)
12
+
13
+
14
+ ## Usage
15
+
6
16
  TBD
7
17
 
8
18
 
@@ -13,4 +23,4 @@ Use it as you please with no restrictions whatsoever.
13
23
 
14
24
  ## Questions? Comments?
15
25
 
16
- Send them along to the [Open Sports Database & Friends Forum/Mailing List](http://groups.google.com/group/opensport). Thanks!
26
+ Send them along to the [Open Sports Database & Friends Forum/Mailing List](http://groups.google.com/group/opensport). Thanks!
data/Rakefile CHANGED
@@ -1,22 +1,19 @@
1
1
  require 'hoe'
2
2
  require './lib/sportdb/play/version.rb'
3
3
 
4
- ## NB: plugin (hoe-manifest) not required; just used for future testing/development
5
- Hoe::plugin :manifest # more options for manifests (in the future; not yet)
6
-
7
4
 
8
5
  Hoe.spec 'sportdb-play' do
9
6
 
10
- self.version = SportDB::Play::VERSION
7
+ self.version = SportDb::Play::VERSION
11
8
 
12
9
  self.summary = 'sportdb plugin for plays (predictions, betting pool, etc.)'
13
10
  self.description = summary
14
11
 
15
- self.urls = ['https://github.com/geraldb/sport.db-play']
16
-
12
+ self.urls = ['https://github.com/openbookie/sport.db.play']
13
+
17
14
  self.author = 'Gerald Bauer'
18
15
  self.email = 'opensport@googlegroups.com'
19
-
16
+
20
17
 
21
18
  ## soft deps (dependencies)
22
19
  ## -- sportdb gem must be installed already
@@ -27,4 +24,4 @@ Hoe.spec 'sportdb-play' do
27
24
  :required_ruby_version => '>= 1.9.2'
28
25
  }
29
26
 
30
- end
27
+ end
data/lib/sportdb/play.rb CHANGED
@@ -17,10 +17,10 @@ require 'sportdb/play/models/tip'
17
17
  require 'sportdb/play/models/user'
18
18
 
19
19
 
20
- module SportDB::Play
20
+ module SportDb::Play
21
21
 
22
22
  def self.banner
23
- "sportdb-play #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
23
+ "sportdb-play/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
24
24
  end
25
25
 
26
26
  ## cut off folders lib(#1)/sportdb(#2) to get to root
@@ -29,11 +29,12 @@ module SportDB::Play
29
29
  end
30
30
 
31
31
  def self.create
32
- CreateDB.up
32
+ CreateDb.new.up
33
+ WorldDb::Models::Prop.create!( key: 'db.schema.sport.play.version', value: VERSION )
33
34
  end
34
35
 
35
- end # module SportDB::Play
36
+ end # module SportDb::Play
36
37
 
37
38
 
38
39
  ## say hello
39
- puts SportDB::Play.banner
40
+ puts SportDb::Play.banner
@@ -1,7 +1,7 @@
1
1
 
2
- ## NB: just use namespace SportDB::Models (not SportDB::Models::Play)
2
+ ## NB: just use namespace SportDb::Models (not SportDb::Models::Play)
3
3
 
4
- module SportDB::Models
4
+ module SportDb::Models
5
5
 
6
6
 
7
7
  class BonusPoint < ActiveRecord::Base
@@ -13,5 +13,4 @@ class BonusPoint < ActiveRecord::Base
13
13
  end # class BonusPoint
14
14
 
15
15
 
16
-
17
- end # module SportDB::Models
16
+ end # module SportDb::Models
@@ -1,7 +1,7 @@
1
1
 
2
- ## NB: just use namespace SportDB::Models (not SportDB::Models::Play)
2
+ ## NB: just use namespace SportDb::Models (not SportDb::Models::Play)
3
3
 
4
- module SportDB::Models
4
+ module SportDb::Models
5
5
 
6
6
 
7
7
  class BonusQuestion < ActiveRecord::Base
@@ -13,4 +13,4 @@ class BonusQuestion < ActiveRecord::Base
13
13
  end # class BonusQuestion
14
14
 
15
15
 
16
- end # module SportDB::Models
16
+ end # module SportDb::Models
@@ -1,7 +1,7 @@
1
1
 
2
- ## NB: just use namespace SportDB::Models (not SportDB::Models::Play)
2
+ ## NB: just use namespace SportDb::Models (not SportDb::Models::Play)
3
3
 
4
- module SportDB::Models
4
+ module SportDb::Models
5
5
 
6
6
  class BonusRound < ActiveRecord::Base
7
7
 
@@ -12,4 +12,4 @@ class BonusRound < ActiveRecord::Base
12
12
 
13
13
  end # class BonusRound
14
14
 
15
- end # module SportDB::Models
15
+ end # module SportDb::Models
@@ -1,7 +1,7 @@
1
1
 
2
- ## NB: just use namespace SportDB::Models (not SportDB::Models::Play)
2
+ ## NB: just use namespace SportDb::Models (not SportDb::Models::Play)
3
3
 
4
- module SportDB::Models
4
+ module SportDb::Models
5
5
 
6
6
 
7
7
  class BonusTip < ActiveRecord::Base
@@ -13,4 +13,5 @@ class BonusTip < ActiveRecord::Base
13
13
  end # class BonusTip
14
14
 
15
15
 
16
- end # module SportDB::Models
16
+ end # module SportDb::Models
17
+
@@ -1,7 +1,7 @@
1
1
 
2
2
 
3
3
 
4
- module SportDB::Models
4
+ module SportDb::Models
5
5
 
6
6
 
7
7
  ### NB: extend Game model from sport.db gem
@@ -34,58 +34,36 @@ class Game
34
34
 
35
35
 
36
36
  def tip_1_style_class
37
- toto12x == '1' ? ' bingo ' : ' '
37
+ toto1x2 == '1' ? ' bingo ' : ' '
38
38
  end
39
-
39
+
40
40
  def tip_2_style_class
41
- toto12x == '2' ? ' bingo ' : ' '
41
+ toto1x2 == '2' ? ' bingo ' : ' '
42
42
  end
43
-
43
+
44
44
  def tip_x_style_class
45
- toto12x == 'X' ? ' bingo ' : ' '
45
+ toto1x2 == 'X' ? ' bingo ' : ' '
46
46
  end
47
47
 
48
48
 
49
49
  ############ some methods for stats
50
50
 
51
- def complete_tips
52
- tips.where( 'toto12x is not null' )
53
- end
51
+ def complete_tips() tips.complete; end
52
+ def complete_tips_1() tips.complete1.order( 'score1 desc,score2 desc'); end
53
+ def complete_tips_2() tips.complete2.order( 'score2 desc,score1 desc'); end
54
+ def complete_tips_x() tips.completex.order( 'score1 desc,score2 desc'); end
54
55
 
55
- def complete_tips_1
56
- tips.where( 'toto12x is not null' ).where( :toto12x => '1' ).order( 'score1 desc,score2 desc')
57
- end
56
+ def incomplete_tips() tips.incomplete; end
57
+
58
+ def tip_1_count() tips.complete1.count(); end
59
+ def tip_2_count() tips.complete2.count(); end
60
+ def tip_x_count() tips.completex.count(); end
61
+
62
+ def tip_12x_count() tips.commplete.count(); end
63
+ def tip_1x2_count() tips.commplete.count(); end # alias for tip_12x_count // or just add/use tip_count add too??
58
64
 
59
- def complete_tips_2
60
- tips.where( 'toto12x is not null' ).where( :toto12x => '2' ).order( 'score2 desc,score1 desc')
61
- end
62
-
63
- def complete_tips_x
64
- tips.where( 'toto12x is not null' ).where( :toto12x => 'X' ).order( 'score1 desc,score2 desc')
65
- end
66
-
67
-
68
- def incomplete_tips
69
- tips.where( 'toto12x is null' )
70
- end
71
-
72
- def tip_1_count
73
- complete_tips.where( :toto12x => '1' ).count()
74
- end
75
-
76
- def tip_2_count
77
- complete_tips.where( :toto12x => '2' ).count()
78
- end
79
-
80
- def tip_x_count
81
- complete_tips.where( :toto12x => 'X' ).count()
82
- end
83
-
84
- def tip_12x_count
85
- complete_tips.count()
86
- end
87
65
 
88
66
  end # class Game
89
67
 
90
68
 
91
- end # module SportDB::Models
69
+ end # module SportDb::Models
@@ -1,7 +1,7 @@
1
1
 
2
- ## NB: just use namespace SportDB::Models (not SportDB::Models::Play)
2
+ ## NB: just use namespace SportDb::Models (not SportDb::Models::Play)
3
3
 
4
- module SportDB::Models
4
+ module SportDb::Models
5
5
 
6
6
  class Play < ActiveRecord::Base
7
7
 
@@ -36,13 +36,15 @@ class Play < ActiveRecord::Base
36
36
 
37
37
  ## todo/fix: can it be done w/ a has_many macro and a condition?
38
38
  def tips
39
- recs = Tip.where( :pool_id => pool_id, :user_id => user_id ).all
39
+ ## nb: removed .all() - check if still working; should - but never know
40
+ recs = Tip.where( pool_id: pool_id, user_id: user_id )
40
41
  recs
41
42
  end
42
43
 
43
44
  ## todo/fix: can it be done w/ a has_many macro and a condition?
44
45
  def complete_rankings # fix rename to points and remove points column from play table??
45
- recs = Point.where( :pool_id => pool_id, :user_id => user_id ).joins( :round ).order('rounds.pos').all
46
+ ## nb: removed .all() - check if still working; should - but never know
47
+ recs = Point.where( pool_id: pool_id, user_id: user_id ).joins( :round ).order('rounds.pos')
46
48
  recs
47
49
  end
48
50
 
@@ -56,4 +58,4 @@ class Play < ActiveRecord::Base
56
58
  end # class Play
57
59
 
58
60
 
59
- end # module SportDB::Models
61
+ end # module SportDb::Models
@@ -1,8 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
- ## NB: just use namespace SportDB::Models (not SportDB::Models::Play)
3
+ ## NB: just use namespace SportDb::Models (not SportDb::Models::Play)
4
4
 
5
- module SportDB::Models
5
+ module SportDb::Models
6
6
 
7
7
 
8
8
  class Point < ActiveRecord::Base
@@ -52,4 +52,4 @@ class Point < ActiveRecord::Base
52
52
  end # class Point
53
53
 
54
54
 
55
- end # module SportDB::Models
55
+ end # module SportDb::Models
@@ -1,8 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
- ## NB: just use namespace SportDB::Models (not SportDB::Models::Play)
3
+ ## NB: just use namespace SportDb::Models (not SportDb::Models::Play)
4
4
 
5
- module SportDB::Models
5
+ module SportDb::Models
6
6
 
7
7
 
8
8
  class Pool < ActiveRecord::Base
@@ -18,7 +18,7 @@ class Pool < ActiveRecord::Base
18
18
 
19
19
  belongs_to :event
20
20
 
21
-
21
+
22
22
  def full_title
23
23
  #### "#{title} #{event.title}#{fix? ? ' Fix' : ''}"
24
24
  "#{title} #{event.title}"
@@ -32,5 +32,5 @@ class Pool < ActiveRecord::Base
32
32
  end # class Pool
33
33
 
34
34
 
35
- end # module SportDB::Models
35
+ end # module SportDb::Models
36
36
 
@@ -1,34 +1,169 @@
1
1
  # encoding: utf-8
2
2
 
3
3
 
4
- ## NB: just use namespace SportDB::Models (not SportDB::Models::Play)
4
+ ## NB: just use namespace SportDb::Models (not SportDb::Models::Play)
5
5
 
6
- module SportDB::Models
6
+ module SportDb::Models
7
7
 
8
8
 
9
9
  class Tip < ActiveRecord::Base
10
-
10
+
11
11
  belongs_to :user
12
12
  belongs_to :pool
13
13
  belongs_to :game
14
14
 
15
- before_save :calc_toto12x
15
+ before_save :calc_winner
16
+
17
+
18
+ def calc_winner
19
+ if score1.nil? || score2.nil?
20
+ self.winner90 = nil
21
+ self.winner = nil
22
+ else
23
+ if score1 > score2
24
+ self.winner90 = 1
25
+ elsif score1 < score2
26
+ self.winner90 = 2
27
+ else # assume score1 == score2 - draw
28
+ self.winner90 = 0
29
+ end
30
+
31
+ ## todo/fix:
32
+ # check for next-game/pre-game !!!
33
+ # use 1st leg and 2nd leg - use for winner too
34
+ # or add new winner_total or winner_aggregated method ???
35
+
36
+ ## check for penalty - note: some games might only have penalty and no extra time (e.g. copa liberatadores)
37
+ if score1p.present? && score2p.present?
38
+ if score1p > score2p
39
+ self.winner = 1
40
+ elsif score1p < score2p
41
+ self.winner = 2
42
+ else
43
+ # issue warning! - should not happen; penalty goes on until winner found!
44
+ puts "*** warn: should not happen; penalty goes on until winner found"
45
+ end
46
+ ## check for extra time
47
+ elsif score1et.present? && score2et.present?
48
+ if score1et > score2et
49
+ self.winner = 1
50
+ elsif score1et < score2et
51
+ self.winner = 2
52
+ else # assume score1et == score2et - draw
53
+ self.winner = 0
54
+ end
55
+ else
56
+ # assume no penalty and no extra time; same as 90min result
57
+ self.winner = self.winner90
58
+ end
59
+ end
60
+ end
61
+
62
+
63
+ ############ some scopes for stats
64
+
65
+ # -- for now always use winner90 (that is, after 90 mins; not extra time or penality etc.)
66
+
67
+ scope :complete, -> { where( 'winner90 is not null' ) }
68
+ scope :complete1, -> { where( 'winner90 is not null' ).where( winner90: 1 ) }
69
+ scope :complete2, -> { where( 'winner90 is not null' ).where( winner90: 2 ) }
70
+ scope :completex, -> { where( 'winner90 is not null' ).where( winner90: 0 ) }
71
+ scope :complete0, -> { where( 'winner90 is not null' ).where( winner90: 0 ) } # alias for completex
72
+
73
+ scope :incomplete, -> { where( 'winner90 is null' ) }
74
+
75
+
76
+ def toto12x() toto1x2; end # alias for toto12x - todo/fix: use ruby alias helper
77
+ def toto1x2
78
+ ## note: will return string e.g. 1-X-2 (winner will return int e.g. 1-0-2)
79
+
80
+ ## fix: use switch/when expr/stmt instead of ifs
81
+ value = winner90 # 1 0 2 1 => team 1 0 => draw 2 => team
82
+ if value == 0
83
+ 'X'
84
+ elsif value == 1
85
+ '1'
86
+ elsif value == 2
87
+ '2'
88
+ elsif value == -1
89
+ nil # ??? - unknown -- include --??? why? why not??
90
+ else
91
+ nil
92
+ end
93
+ end
94
+
95
+
96
+ ### getter/setters for deprecated attribs (score3,4,5,6)
97
+
98
+ def score3
99
+ score1et
100
+ end
101
+
102
+ def score4
103
+ score2et
104
+ end
16
105
 
106
+ def score1ot
107
+ score1et
108
+ end
109
+
110
+ def score2ot
111
+ score2et
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
145
+
146
+
147
+
17
148
  ## todo: rename to find_by_play_and_game ????
18
149
  def self.find_by_user_and_pool_and_game( user_arg, pool_arg, game_arg )
19
- recs = self.where( :user_id => user_arg.id, :pool_id => pool_arg.id, :game_id => game_arg.id )
150
+ recs = self.where( user_id: user_arg.id,
151
+ pool_id: pool_arg.id,
152
+ game_id: game_arg.id )
20
153
  recs.first
21
154
  end
22
-
23
-
155
+
156
+
24
157
  def export?
25
158
  # check if user entered some data
26
159
  # - do NOT export nil records (all scores blank)
27
160
 
28
- (score1.blank? && score2.blank? && score3.blank? && score4.blank? && score5.blank? && score6.blank?)==false
161
+ (score1.blank? && score2.blank? &&
162
+ score1et.blank? && score2et.blank? &&
163
+ score1p.blank? && score2p.blank?) == false
29
164
  end
30
165
 
31
-
166
+
32
167
  def calc_points_worker
33
168
  pts = 0
34
169
 
@@ -47,32 +182,41 @@ class Tip < ActiveRecord::Base
47
182
  # ergebnis richtig?
48
183
  if game.score1 == score1 && game.score2 == score2
49
184
  pts += 2
185
+ else
186
+ # 2nd chance!
187
+ # -- check 4+ rule for result
188
+ if( [game.score1,4].min == [score1,4].min &&
189
+ [game.score2,4].min == [score2,4].min )
190
+ pts += 2
191
+ end
50
192
  end
51
-
52
- ## check n.V.
53
-
54
- if (game.score3.present? && game.score4.present? && score3.present? && score4.present?)
193
+
194
+
195
+ ## check n.V. - after extra time/a.e.t
196
+
197
+ if( game.score1et.present? && game.score2et.present? && score1et.present? && score2et.present?)
55
198
 
56
- if(((game.score3 == game.score4) && (score3 == score4)) ||
57
- ((game.score3 > game.score4) && (score3 > score4)) ||
58
- ((game.score3 < game.score4) && (score3 < score4)))
199
+ if(((game.score1et == game.score2et) && (score1et == score2et)) ||
200
+ ((game.score1et > game.score2et) && (score1et > score2et)) ||
201
+ ((game.score1et < game.score2et) && (score1et < score2et)))
59
202
  pts += 1
60
203
  end
61
204
  end
62
-
205
+
63
206
  ## check i.E.
64
207
 
65
- if (game.score5.present? && game.score6.present? && score5.present? && score6.present?)
208
+ if( game.score1p.present? && game.score2p.present? && score1p.present? && score2p.present?)
66
209
 
67
- if(((game.score5 > game.score6) && (score5 > score6)) ||
68
- ((game.score5 < game.score6) && (score5 < score6)))
210
+ if(((game.score1p > game.score2p) && (score1p > score2p)) ||
211
+ ((game.score1p < game.score2p) && (score1p < score2p)))
69
212
  pts += 1
70
213
  end
71
214
  end
72
215
 
73
216
  pts
74
217
  end
75
-
218
+
219
+
76
220
  def calc_points
77
221
  pts = 0
78
222
  pts = calc_points_worker() if complete?
@@ -172,24 +316,12 @@ class Tip < ActiveRecord::Base
172
316
  end
173
317
  end
174
318
  end
175
-
176
- def calc_toto12x
177
- if score1.nil? || score2.nil?
178
- self.toto12x = nil
179
- elsif score1 == score2
180
- self.toto12x = 'X'
181
- elsif score1 > score2
182
- self.toto12x = '1'
183
- elsif score1 < score2
184
- self.toto12x = '2'
185
- end
186
- end
187
-
319
+
188
320
 
189
321
  def complete?
190
322
  game.score1.present? && game.score2.present? && score1.present? && score2.present?
191
323
  end
192
-
324
+
193
325
  def incomplete?
194
326
  complete? == false
195
327
  end
@@ -210,16 +342,20 @@ class Tip < ActiveRecord::Base
210
342
  end
211
343
 
212
344
  def score_str
345
+
346
+ ## fix: check game
347
+ # use buf and allow result90 plus penalty only too
348
+
213
349
  ## fix: use new game.toto12x instead of game.over ??? (doesn't depend on time)
214
350
  if score1.blank? && score2.blank? && game.over?
215
351
  # return no data marker (e.g. middot) if not touched by user
216
352
  '·'
217
353
  else
218
354
  str = ''
219
- if score5.present? && score6.present? # im Elfmeterschiessen i.E.?
220
- str = "#{score1_str} : #{score2_str} / #{score3} : #{score4} n.V. / #{score5} : #{score6} i.E."
221
- elsif score3.present? && score4.present? # nach Verlaengerung n.V.?
222
- str = "#{score1_str} : #{score2_str} / #{score3} : #{score4} n.V."
355
+ if score1p.present? && score2p.present? # im Elfmeterschiessen i.E.?
356
+ str = "#{score1_str} : #{score2_str} / #{score1et} : #{score2et} n.V. / #{score1p} : #{score2p} i.E."
357
+ elsif score1et.present? && score2et.present? # nach Verlaengerung n.V.?
358
+ str = "#{score1_str} : #{score2_str} / #{score1et} : #{score2et} n.V."
223
359
  else
224
360
  str = "#{score1_str} : #{score2_str}"
225
361
  end
@@ -233,15 +369,10 @@ class Tip < ActiveRecord::Base
233
369
  str
234
370
  end
235
371
  end
236
-
237
- def score1_str
238
- if score1.blank? then '?' else score1.to_s end
239
- end
240
372
 
241
- def score2_str
242
- if score2.blank? then '?' else score2.to_s end
243
- end
373
+ def score1_str() score1.blank? ? '?' : score1.to_s; end
374
+ def score2_str() score2.blank? ? '?' : score2.to_s; end
244
375
 
245
376
  end # class Tip
246
377
 
247
- end # module SportDB::Models
378
+ end # module SportDb::Models
@@ -1,9 +1,9 @@
1
1
  # encoding: utf-8
2
2
 
3
3
 
4
- ## NB: just use namespace SportDB::Models (not SportDB::Models::Play)
4
+ ## NB: just use namespace SportDb::Models (not SportDb::Models::Play)
5
5
 
6
- module SportDB::Models
6
+ module SportDb::Models
7
7
 
8
8
 
9
9
  class User < ActiveRecord::Base
@@ -15,4 +15,4 @@ class User < ActiveRecord::Base
15
15
 
16
16
  end # class User
17
17
 
18
- end # module SportDB::Models
18
+ end # module SportDb::Models
@@ -1,15 +1,8 @@
1
- module SportDB::Play
1
+ module SportDb::Play
2
2
 
3
- class CreateDB
3
+ class CreateDb < ActiveRecord::Migration
4
4
 
5
- ## make models available in sportdb module by default with namespace
6
- # e.g. lets you use Team instead of Models::Team
7
- include SportDB::Models
8
-
9
-
10
- def self.up
11
-
12
- ActiveRecord::Schema.define do
5
+ def up
13
6
 
14
7
  ## NB: assumes a table users already exists with a col key
15
8
  ## lets add a check? why? why not?
@@ -18,6 +11,7 @@ change_table :games do |t|
18
11
  t.boolean :locked, :null => false, :default => false
19
12
  end
20
13
 
14
+
21
15
  #####################################
22
16
  ## new tables / create tables
23
17
  ####################################
@@ -61,15 +55,17 @@ create_table :tips do |t|
61
55
  t.references :game, :null => false
62
56
  t.integer :score1
63
57
  t.integer :score2
64
- t.integer :score3 # verlaengerung (opt)
65
- t.integer :score4
66
- t.integer :score5 # elfmeter (opt)
67
- t.integer :score6
68
- t.string :toto12x # 1,2,X,nil calculate on save
58
+ t.integer :score1et # verlaengerung (opt) - extra time/e.t
59
+ t.integer :score2et
60
+ t.integer :score1p # elfmeter (opt)
61
+ t.integer :score2p
62
+ t.integer :winner90 # 1,2,0,nil calculate on save
63
+ t.integer :winner # 1,2,0,nil calculate on save
69
64
 
70
65
  t.timestamps
71
66
  end
72
67
 
68
+
73
69
  add_index :tips, [:user_id,:pool_id,:game_id], :unique => true
74
70
  add_index :tips, :user_id
75
71
  add_index :tips, :pool_id
@@ -141,13 +137,14 @@ end
141
137
 
142
138
  add_index :bonus_points, [:user_id,:pool_id,:round_id], :unique => true
143
139
 
144
- end # block Schema.define
140
+ end # method up
145
141
 
146
- Prop.create!( key: 'db.schema.sport.play.version', value: SportDB::Play::VERSION )
147
142
 
148
- end # method self.up
143
+ def down
144
+ raise ActiveRecord::IrreversibleMigration
145
+ end
149
146
 
150
- end # class CreateDB
147
+ end # class CreateDb
151
148
 
152
149
 
153
- end # module SportDB::Play
150
+ end # module SportDb::Play
@@ -1,7 +1,7 @@
1
1
 
2
- module SportDB ; end # forward reference (for hoe require)
2
+ module SportDb ; end # forward reference (for hoe require)
3
3
 
4
- module SportDB::Play
5
- VERSION = '0.2.0'
4
+ module SportDb::Play
5
+ VERSION = '0.2.1'
6
6
  end
7
7
 
metadata CHANGED
@@ -1,61 +1,45 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sportdb-play
3
- version: !ruby/object:Gem::Version
4
- hash: 23
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Gerald Bauer
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-12-04 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2013-11-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rdoc
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &72288070 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 19
29
- segments:
30
- - 3
31
- - 10
32
- version: "3.10"
20
+ - !ruby/object:Gem::Version
21
+ version: '3.10'
33
22
  type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: hoe
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *72288070
25
+ - !ruby/object:Gem::Dependency
26
+ name: hoe
27
+ requirement: &72287840 !ruby/object:Gem::Requirement
39
28
  none: false
40
- requirements:
29
+ requirements:
41
30
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 1
44
- segments:
45
- - 3
46
- - 3
47
- version: "3.3"
31
+ - !ruby/object:Gem::Version
32
+ version: '3.3'
48
33
  type: :development
49
- version_requirements: *id002
34
+ prerelease: false
35
+ version_requirements: *72287840
50
36
  description: sportdb plugin for plays (predictions, betting pool, etc.)
51
37
  email: opensport@googlegroups.com
52
38
  executables: []
53
-
54
39
  extensions: []
55
-
56
- extra_rdoc_files:
40
+ extra_rdoc_files:
57
41
  - Manifest.txt
58
- files:
42
+ files:
59
43
  - History.md
60
44
  - Manifest.txt
61
45
  - README.md
@@ -73,41 +57,31 @@ files:
73
57
  - lib/sportdb/play/models/user.rb
74
58
  - lib/sportdb/play/schema.rb
75
59
  - lib/sportdb/play/version.rb
76
- homepage: https://github.com/geraldb/sport.db-play
77
- licenses:
60
+ homepage: https://github.com/openbookie/sport.db.play
61
+ licenses:
78
62
  - Public Domain
79
63
  post_install_message:
80
- rdoc_options:
64
+ rdoc_options:
81
65
  - --main
82
66
  - README.md
83
- require_paths:
67
+ require_paths:
84
68
  - lib
85
- required_ruby_version: !ruby/object:Gem::Requirement
69
+ required_ruby_version: !ruby/object:Gem::Requirement
86
70
  none: false
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- hash: 55
91
- segments:
92
- - 1
93
- - 9
94
- - 2
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
95
74
  version: 1.9.2
96
- required_rubygems_version: !ruby/object:Gem::Requirement
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
76
  none: false
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- hash: 3
102
- segments:
103
- - 0
104
- version: "0"
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
105
81
  requirements: []
106
-
107
82
  rubyforge_project: sportdb-play
108
- rubygems_version: 1.8.24
83
+ rubygems_version: 1.8.17
109
84
  signing_key:
110
85
  specification_version: 3
111
86
  summary: sportdb plugin for plays (predictions, betting pool, etc.)
112
87
  test_files: []
113
-