sportdb-play 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -162,11 +162,21 @@ class Tip < ActiveRecord::Base
162
162
  ## check n.V. - after extra time/a.e.t
163
163
 
164
164
  if( game.score1et.present? && game.score2et.present? && score1et.present? && score2et.present?)
165
-
165
+
166
166
  if(((game.score1et == game.score2et) && (score1et == score2et)) ||
167
167
  ((game.score1et > game.score2et) && (score1et > score2et)) ||
168
168
  ((game.score1et < game.score2et) && (score1et < score2et)))
169
- pts += 1
169
+
170
+ ### note: disqualify (no pts) if tip for regular time is NOT draw/tie
171
+ ###
172
+ if score1 == score2
173
+ pts += 1
174
+
175
+ # ergebnis richtig? extra point
176
+ if game.score1et == score1et && game.score2et == score2et
177
+ pts += 1
178
+ end
179
+ end
170
180
  end
171
181
  end
172
182
 
@@ -176,10 +186,20 @@ class Tip < ActiveRecord::Base
176
186
 
177
187
  if(((game.score1p > game.score2p) && (score1p > score2p)) ||
178
188
  ((game.score1p < game.score2p) && (score1p < score2p)))
179
- pts += 1
189
+
190
+ ### note: disqualify (no pts) if tip for regular and extra time is NOT draw/tie
191
+ ###
192
+ if score1 == score2 && score1et == score2et
193
+ pts += 1
194
+
195
+ # ergebnis richtig? extra point
196
+ if game.score1p == score1p && game.score2p == score2p
197
+ pts += 1
198
+ end
199
+ end
180
200
  end
181
201
  end
182
-
202
+
183
203
  pts
184
204
  end
185
205
 
@@ -196,9 +216,9 @@ class Tip < ActiveRecord::Base
196
216
  buf
197
217
  end
198
218
 
199
-
219
+
200
220
  ## todo: use tip-fail, tip-bingo, etc.
201
-
221
+
202
222
  def bingo_style_class
203
223
  if incomplete?
204
224
  # show missing label for upcoming games only
@@ -213,11 +233,11 @@ class Tip < ActiveRecord::Base
213
233
  pts = calc_points()
214
234
  if pts == 0
215
235
  'fail'
216
- elsif pts == 1
236
+ elsif pts == 1 || pts == 2
217
237
  'bingo'
218
- elsif pts == 2
219
- 'bingoo'
220
238
  elsif pts == 3
239
+ 'bingoo'
240
+ elsif pts >= 4 # note; use greater 4 for now - add more bingooo states? how to deal w/ custom points - normalize - how ??
221
241
  'bingooo'
222
242
  else
223
243
  '' # unknown state; return empty (css) class
@@ -240,11 +260,11 @@ class Tip < ActiveRecord::Base
240
260
  pts = calc_points()
241
261
  if pts == 0
242
262
  ''
243
- elsif pts == 1
263
+ elsif pts == 1 || pts == 2
244
264
  'bingo'
245
- elsif pts == 2
246
- 'bingoo'
247
265
  elsif pts == 3
266
+ 'bingoo'
267
+ elsif pts >= 4
248
268
  'bingooo'
249
269
  else
250
270
  '' # unknown state; return empty (css) class
@@ -278,6 +298,16 @@ class Tip < ActiveRecord::Base
278
298
  '♣♣ 2 Pkte - Jaaa!'
279
299
  elsif pts == 3
280
300
  '♣♣♣ 3 Pkte - Jaaaaa!'
301
+ elsif pts == 4
302
+ '♣♣♣ 4 Pkte - Jaaaaaa!'
303
+ elsif pts == 5
304
+ '♣♣♣ 5 Pkte - Jaaaaaaa!'
305
+ elsif pts == 6
306
+ '♣♣♣ 6 Pkte - Jaaaaaaaa!'
307
+ elsif pts == 7
308
+ '♣♣♣ 7 Pkte - Jaaaaaaaaa!'
309
+ elsif pts == 8
310
+ '♣♣♣ 8 Pkte - Wahnsinnn!' # max points? 2pt+2pt + (1pt+1pt) + (1pt+1pt)
281
311
  else
282
312
  '' # unknown state; return empty (css) class
283
313
  end
@@ -326,7 +356,7 @@ class Tip < ActiveRecord::Base
326
356
  else
327
357
  str = "#{score1_str} : #{score2_str}"
328
358
  end
329
-
359
+
330
360
  ##### FIX: make extendable!!
331
361
  # if calc
332
362
  # str_calc_team1 = calc_team1_id.blank? ? '' : calc_team1.tag
@@ -2,6 +2,7 @@
2
2
 
3
3
  module SportDb
4
4
  module Play
5
- VERSION = '0.2.4'
5
+ VERSION = '0.2.5'
6
6
  end
7
7
  end
8
+
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
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-26 00:00:00.000000000 Z
12
+ date: 2014-07-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc
16
- requirement: &73885540 !ruby/object:Gem::Requirement
16
+ requirement: &83745020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '4.0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *73885540
24
+ version_requirements: *83745020
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: hoe
27
- requirement: &73885280 !ruby/object:Gem::Requirement
27
+ requirement: &83744770 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '3.11'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *73885280
35
+ version_requirements: *83744770
36
36
  description: sportdb plugin for plays (predictions, betting pool, etc.)
37
37
  email: opensport@googlegroups.com
38
38
  executables: []