tournament 3.2.2 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 3.3.0 / 2009-03-16
2
+ * Final 2010 bracket.
3
+ * Fix permissions issue making tournament bracket seem editable to all.
4
+ * Show login name in leader board.
5
+
1
6
  == 3.2.2 / 2009-03-14
2
7
  * Fix initialization of tournament entry.
3
8
 
data/README.rdoc CHANGED
@@ -1,5 +1,5 @@
1
1
  tournament
2
- by Douglas A. Seifert (doug+rubyforge at dseifert dot net)
2
+ by Douglas A. Seifert (doug at dseifert dot net)
3
3
  http://www.dseifert.net/code/tournament
4
4
  http://github.org/seifertd/tournament
5
5
  http://rubygems.org/gems/tournament
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ Bones {
17
17
 
18
18
  name 'tournament'
19
19
  authors 'Douglas A. Seifert'
20
- email 'doug+rubyforge@dseifert.net'
20
+ email 'doug@dseifert.net'
21
21
  url 'http://www.dseifert.net/code/tournament'
22
22
  rubyforge.name 'tournament'
23
23
  readme_file 'README.rdoc'
data/lib/tournament.rb CHANGED
@@ -7,7 +7,7 @@ unless defined? Tournament
7
7
  module Tournament
8
8
 
9
9
  # :stopdoc:
10
- VERSION = '3.2.2'
10
+ VERSION = '3.3.0'
11
11
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
12
12
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
13
13
  # :startdoc:
@@ -278,6 +278,96 @@ class Tournament::Pool
278
278
  return pool
279
279
  end
280
280
 
281
+ # Creates a Pool object for the 2010 NCAA tournament
282
+ def self.ncaa_2010
283
+ pool = Tournament::Pool.new
284
+ pool.add_region("Midwest",
285
+ [
286
+ Tournament::Team.new('Kansas', 'Kan', 1),
287
+ Tournament::Team.new('Lehigh', 'Leh', 16),
288
+ Tournament::Team.new('UNLV', 'ULV', 8),
289
+ Tournament::Team.new('Northern Iowa', 'NIo', 9),
290
+ Tournament::Team.new('Michigan St.', 'MSU', 5),
291
+ Tournament::Team.new('New Mexico State', 'NMS', 12),
292
+ Tournament::Team.new('Maryland', 'Mry', 4),
293
+ Tournament::Team.new('Houston', 'Hou', 13),
294
+ Tournament::Team.new('Tennessee', 'Ten', 6),
295
+ Tournament::Team.new('San Diego State', 'SDS', 11),
296
+ Tournament::Team.new('Georgetown', 'GT', 3),
297
+ Tournament::Team.new('Ohio', 'Ohi', 14),
298
+ Tournament::Team.new('Oklahoma State', 'OkS', 7),
299
+ Tournament::Team.new('Georgia Tech', 'GTc', 10),
300
+ Tournament::Team.new('Ohio State', 'OSU', 2),
301
+ Tournament::Team.new('UC Santa Barbara', 'SB', 15)
302
+ ],
303
+ 0
304
+ )
305
+ pool.add_region("West",
306
+ [
307
+ Tournament::Team.new('Syracuse', 'Syr', 1),
308
+ Tournament::Team.new('Vermont', 'Ver', 16),
309
+ Tournament::Team.new('Gonzaga', 'Gon', 8),
310
+ Tournament::Team.new('Florida State', 'FSU', 9),
311
+ Tournament::Team.new('Butler', 'But', 5),
312
+ Tournament::Team.new('UTEP', 'UTP', 12),
313
+ Tournament::Team.new('Vanderbilt', 'Van', 4),
314
+ Tournament::Team.new('Murray State', 'Mur', 13),
315
+ Tournament::Team.new('Xavier', 'Xav', 6),
316
+ Tournament::Team.new('Minnesota', 'Min', 11),
317
+ Tournament::Team.new('Pittsburgh', 'Pit', 3),
318
+ Tournament::Team.new('Oakland', 'Oak', 14),
319
+ Tournament::Team.new('BYU', 'BYU', 7),
320
+ Tournament::Team.new('Florida', 'Fla', 10),
321
+ Tournament::Team.new('Kansas St.', 'KSU', 2),
322
+ Tournament::Team.new('Nort Texas', 'NTx', 15)
323
+ ],
324
+ 1
325
+ )
326
+ pool.add_region("East",
327
+ [
328
+ Tournament::Team.new('Kentucky', 'Ken', 1),
329
+ Tournament::Team.new('East Tennessee State', 'ETS', 16),
330
+ Tournament::Team.new('Texas', 'Tex', 8),
331
+ Tournament::Team.new('Wake Forest', 'WkF', 9),
332
+ Tournament::Team.new('Temple', 'Tem', 5),
333
+ Tournament::Team.new('Cornell', 'Cor', 12),
334
+ Tournament::Team.new('Wisconsin', 'Wis', 4),
335
+ Tournament::Team.new('Wofford', 'Wof', 13),
336
+ Tournament::Team.new('Marquette', 'Mar', 6),
337
+ Tournament::Team.new('Washington', 'Was', 11),
338
+ Tournament::Team.new('New Mexico', 'NMx', 3),
339
+ Tournament::Team.new('Montana', 'Mon', 14),
340
+ Tournament::Team.new('Clemson', 'Clm', 7),
341
+ Tournament::Team.new('Missouri', 'Msr', 10),
342
+ Tournament::Team.new('West Virginia', 'WVa', 2),
343
+ Tournament::Team.new('Morgan State', 'MgS', 15)
344
+ ],
345
+ 2
346
+ )
347
+ pool.add_region("South",
348
+ [
349
+ Tournament::Team.new('Duke', 'Duk', 1),
350
+ Tournament::Team.new('Arkansa-Pine Bluff', 'APB', 16),
351
+ Tournament::Team.new('California', 'Cal', 8),
352
+ Tournament::Team.new('Louisville', 'Lou', 9),
353
+ Tournament::Team.new('Texas A&M', 'A&M', 5),
354
+ Tournament::Team.new('Utah State', 'USt', 12),
355
+ Tournament::Team.new('Purdue', 'Pur', 4),
356
+ Tournament::Team.new('Siena', 'Sie', 13),
357
+ Tournament::Team.new('Notre Dame', 'ND', 6),
358
+ Tournament::Team.new('Old Dominion', 'OD', 11),
359
+ Tournament::Team.new('Baylor', 'Bay', 3),
360
+ Tournament::Team.new('Sam Houston State', 'SHS', 14),
361
+ Tournament::Team.new('Richmond', 'Rch', 7),
362
+ Tournament::Team.new("St. Mary's", 'StM', 10),
363
+ Tournament::Team.new('Villanova', 'Vil', 2),
364
+ Tournament::Team.new('Robert Morris', 'RbM', 15)
365
+ ],
366
+ 3
367
+ )
368
+ return pool
369
+ end
370
+
281
371
  # Run a test pool with random entries and a random outcome.
282
372
  def self.test(num_picks = 20)
283
373
  pool = ncaa_2008
@@ -21,6 +21,7 @@
21
21
  <td rowspan="2">Current<br/>Score</td>
22
22
  <td rowspan="2">Max Score</td>
23
23
  <td rowspan="2">Entry Name</td>
24
+ <td rowspan="2">By</td>
24
25
  <td rowspan="2">Champ<br/>Alive?</td>
25
26
  <td rowspan="2">Tie<br/>Break</td>
26
27
  <td colspan="6">Round Scores</td>
@@ -36,7 +37,7 @@
36
37
  </thead>
37
38
  <tbody>
38
39
  <%
39
- db_entry_ids = @pool.user_entries.inject({}) {|h,e| h[e.name] = e.id; h}
40
+ db_entries = @pool.user_entries.inject({}) {|h,e| h[e.name] = e; h}
40
41
  pool.entries.sort do |e1, e2|
41
42
  s1 = e1.picks.score_against(pool.tournament_entry.picks, pool.scoring_strategy)
42
43
  s2 = e2.picks.score_against(pool.tournament_entry.picks, pool.scoring_strategy)
@@ -44,6 +45,10 @@
44
45
  s1 = 0 - (e1.tie_breaker - pool.tournament_entry.tie_breaker).abs
45
46
  s2 = 0 - (e2.tie_breaker - pool.tournament_entry.tie_breaker).abs
46
47
  end
48
+ if s1 == s2
49
+ s1 = e1.max_score
50
+ s2 = e2.max_score
51
+ end
47
52
  s2 <=> s1
48
53
  end.inject(nil) do |last_entry, entry|
49
54
  total = entry.picks.score_against(pool.tournament_entry.picks, pool.scoring_strategy)
@@ -65,7 +70,8 @@
65
70
  <td><%=rank_display%></td>
66
71
  <td><%=total%></td>
67
72
  <td><%=max%></td>
68
- <td><%=link_to entry.name, :controller => 'entry', :action => 'show', :id => db_entry_ids[entry.name]%></td>
73
+ <td><%=link_to entry.name, :controller => 'entry', :action => 'show', :id => db_entries[entry.name].id%></td>
74
+ <td><%=db_entries[entry.name].user.login%></td>
69
75
  <td><%=champ.short_name%> <%=pool.tournament_entry.picks.still_alive?(champ) ? 'Y' : 'N'%></td>
70
76
  <td><%=entry.tie_breaker || '-'%></td>
71
77
  <% round_scores.each do |rs| %>
@@ -1,5 +1,5 @@
1
1
  <%
2
- is_editable = defined?(editable) ? editable : (current_user.has_role?(:admin) || Time.now < @entry.pool.starts_at)
2
+ is_editable = defined?(editable) ? editable : (current_user.has_role?(:admin) || (@entry.pool.accepting_entries? && @entry.user == current_user ) )
3
3
  classes = {}
4
4
  ids = {}
5
5
  onclicks = {}
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 3
7
- - 2
8
- - 2
9
- version: 3.2.2
7
+ - 3
8
+ - 0
9
+ version: 3.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Douglas A. Seifert
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-13 23:00:00 -08:00
17
+ date: 2010-03-16 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -76,7 +76,7 @@ dependencies:
76
76
  description: |-
77
77
  Small library, command line program and Rails web GUI for managing a NCAA
78
78
  basketball tournament pool.
79
- email: doug+rubyforge@dseifert.net
79
+ email: doug@dseifert.net
80
80
  executables:
81
81
  - benchmark_pool
82
82
  - gui.rb