tournament 2.0.0 → 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.
data/History.txt CHANGED
@@ -1,4 +1,10 @@
1
- == 2.0.0 / 2009-02-XX
1
+ == 2.1.0 / 2009-03-15
2
+ * Update for 2009 NCAA tournament seedings
3
+ * Leader board report is HTML instead of text
4
+ * Minor formatting changes for main page
5
+ * 2.1.1 release when play-in game is decided.
6
+
7
+ == 2.0.0 / 2009-03-12
2
8
  * Release Rails GUI for self-service entries and admin
3
9
  * Make reports account for tournament tie breaker.
4
10
  * YAML format change from version 1.X. Old pool data won't work
data/Manifest.txt CHANGED
@@ -71,6 +71,7 @@ webgui/app/views/layouts/default.html.erb
71
71
  webgui/app/views/layouts/print.html.erb
72
72
  webgui/app/views/layouts/report.html.erb
73
73
  webgui/app/views/pool/index.html.erb
74
+ webgui/app/views/reports/_leader.html.erb
74
75
  webgui/app/views/reports/_report.html.erb
75
76
  webgui/app/views/reports/show.html.erb
76
77
  webgui/app/views/sessions/new.html.erb
@@ -90,6 +91,7 @@ webgui/config/environments/test.rb
90
91
  webgui/config/initializers/inflections.rb
91
92
  webgui/config/initializers/mime_types.rb
92
93
  webgui/config/initializers/new_rails_defaults.rb
94
+ webgui/config/initializers/ordinal.rb
93
95
  webgui/config/initializers/pool.rb
94
96
  webgui/config/initializers/site_keys.rb
95
97
  webgui/config/locales/en.yml
@@ -114,6 +116,7 @@ webgui/db/migrate/20090301014710_create_teams.rb
114
116
  webgui/db/migrate/20090301025902_add_more_teams.rb
115
117
  webgui/db/migrate/20090301041526_create_seedings.rb
116
118
  webgui/db/migrate/20090301090511_create_regions.rb
119
+ webgui/db/migrate/20090316023841_change_illinois_short_name.rb
117
120
  webgui/db/migrate/teams.txt
118
121
  webgui/db/pool.yml
119
122
  webgui/db/schema.rb
@@ -147,6 +150,7 @@ webgui/public/stylesheets/bracket.css
147
150
  webgui/public/stylesheets/main.css
148
151
  webgui/public/stylesheets/prince.css
149
152
  webgui/public/stylesheets/prince_landscape.css
153
+ webgui/public/stylesheets/reports.css
150
154
  webgui/script/about
151
155
  webgui/script/console
152
156
  webgui/script/dbconsole
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ PROJ.authors = 'Douglas A. Seifert'
20
20
  PROJ.email = 'doug+rubyforge@dseifert.net'
21
21
  PROJ.url = 'http://www.dseifert.net/code/tournament'
22
22
  PROJ.rubyforge.name = 'tournament'
23
- PROJ.version = '2.0.0'
23
+ PROJ.version = '2.1.0'
24
24
  PROJ.group_id = 5863
25
25
 
26
26
  PROJ.spec.opts << '--color'
@@ -183,6 +183,96 @@ class Tournament::Pool
183
183
  return pool
184
184
  end
185
185
 
186
+ # Creates a Pool object for the 2009 NCAA tournament
187
+ def self.ncaa_2009
188
+ pool = Tournament::Pool.new
189
+ pool.add_region("Midwest",
190
+ [
191
+ Tournament::Team.new('Louisville', 'UNC', 1),
192
+ Tournament::Team.new('TBD', 'TBD', 16),
193
+ Tournament::Team.new('Ohio State', 'OSU', 8),
194
+ Tournament::Team.new('Siena', 'Sie', 9),
195
+ Tournament::Team.new('Utah', 'Uta', 5),
196
+ Tournament::Team.new('Arizona', 'UA', 12),
197
+ Tournament::Team.new('Wake Forest', 'WkF', 4),
198
+ Tournament::Team.new('Cleveland State', 'ClS', 13),
199
+ Tournament::Team.new('West Virginia', 'WVa', 6),
200
+ Tournament::Team.new('Dayton', 'Day', 11),
201
+ Tournament::Team.new('Kansas', 'Kan', 3),
202
+ Tournament::Team.new('North Dakota State', 'NDS', 14),
203
+ Tournament::Team.new('Boston College', 'BC', 7),
204
+ Tournament::Team.new('USC', 'USC', 10),
205
+ Tournament::Team.new('Michigan State', 'MSU', 2),
206
+ Tournament::Team.new('Robert Morris', 'RbM', 15)
207
+ ],
208
+ 0
209
+ )
210
+ pool.add_region("West",
211
+ [
212
+ Tournament::Team.new('Connecticut', 'Con', 1),
213
+ Tournament::Team.new('Chattanooga', 'Cht', 16),
214
+ Tournament::Team.new('BYU', 'BYU', 8),
215
+ Tournament::Team.new('Texas A&M', 'A&M', 9),
216
+ Tournament::Team.new('Purdue', 'Pur', 5),
217
+ Tournament::Team.new('Northern Iowa', 'NIo', 12),
218
+ Tournament::Team.new('Washington', 'Was', 4),
219
+ Tournament::Team.new('Mississippi State', 'MiS', 13),
220
+ Tournament::Team.new('Marquette', 'Mar', 6),
221
+ Tournament::Team.new('Utah State', 'USt', 11),
222
+ Tournament::Team.new('Missouri', 'Msr', 3),
223
+ Tournament::Team.new('Cornell', 'Cor', 14),
224
+ Tournament::Team.new('California', 'Cal', 7),
225
+ Tournament::Team.new('Maryland', 'Mry', 10),
226
+ Tournament::Team.new('Memphis', 'Mem', 2),
227
+ Tournament::Team.new('Cal State Northridge', 'CSN', 15)
228
+ ],
229
+ 1
230
+ )
231
+ pool.add_region("East",
232
+ [
233
+ Tournament::Team.new('Pittsburgh', 'Pit', 1),
234
+ Tournament::Team.new('East Tennessee State', 'ETS', 16),
235
+ Tournament::Team.new('Oklahoma State', 'OkS', 8),
236
+ Tournament::Team.new('Tennessee', 'Ten', 9),
237
+ Tournament::Team.new('Florida State', 'FSU', 5),
238
+ Tournament::Team.new('Wisconsin', 'Wis', 12),
239
+ Tournament::Team.new('Xavier', 'Xav', 4),
240
+ Tournament::Team.new('Portland St', 'PSt', 13),
241
+ Tournament::Team.new('UCLA', 'ULA', 6),
242
+ Tournament::Team.new('Virginia Commonwealth', 'VAC', 11),
243
+ Tournament::Team.new('Villanova', 'Vil', 3),
244
+ Tournament::Team.new('Cornell', 'Cor', 14),
245
+ Tournament::Team.new('Texas', 'Tex', 7),
246
+ Tournament::Team.new('Minnesota', 'Min', 10),
247
+ Tournament::Team.new('Duke', 'Duk', 2),
248
+ Tournament::Team.new('Binghamton', 'Bin', 15)
249
+ ],
250
+ 2
251
+ )
252
+ pool.add_region("South",
253
+ [
254
+ Tournament::Team.new('North Carolina', 'UNC', 1),
255
+ Tournament::Team.new('Radford', 'Rad', 16),
256
+ Tournament::Team.new('LSU', 'LSU', 8),
257
+ Tournament::Team.new('Butler', 'But', 9),
258
+ Tournament::Team.new('Illinois', 'Ill', 5),
259
+ Tournament::Team.new('W. Kentucky', 'WKy', 12),
260
+ Tournament::Team.new('Gonzaga', 'Gon', 4),
261
+ Tournament::Team.new('Akron', 'Akr', 13),
262
+ Tournament::Team.new('Arizona State', 'ASU', 6),
263
+ Tournament::Team.new('Temple', 'Tem', 11),
264
+ Tournament::Team.new('Syracuse', 'Syr', 3),
265
+ Tournament::Team.new('Stephen F. Austin', 'SFA', 14),
266
+ Tournament::Team.new('Clemson', 'Cle', 7),
267
+ Tournament::Team.new('Michigan', 'UM', 10),
268
+ Tournament::Team.new('Oklahoma', 'Okl', 2),
269
+ Tournament::Team.new('Morgan State', 'MgS', 15)
270
+ ],
271
+ 3
272
+ )
273
+ return pool
274
+ end
275
+
186
276
  # Run a test pool with random entries and a random outcome.
187
277
  def self.test(num_picks = 20)
188
278
  pool = ncaa_2008
@@ -22,6 +22,7 @@ class TeamsController < ApplicationController
22
22
 
23
23
  def change
24
24
  @pool = Pool.find(params[:id])
25
+ Pool.transaction do
25
26
  [0,1,2,3].each do |region_idx|
26
27
  region_hash = params["region#{region_idx}".to_sym]
27
28
  next unless region_hash
@@ -40,7 +41,11 @@ class TeamsController < ApplicationController
40
41
  logger.debug("SAVING SEEDINGS: #{region_hash[:seedings].inspect}")
41
42
  region_hash[:seedings].each do |seeding_hash|
42
43
  next if seeding_hash[:name].blank? || seeding_hash[:short_name].blank?
43
- team = Team.find_or_create_by_short_name(seeding_hash[:short_name], :name => seeding_hash[:name])
44
+ team = Team.find_or_initialize_by_short_name(seeding_hash[:short_name]) {|t| t.name = seeding_hash[:name]}
45
+ if team.new_record?
46
+ logger.debug("SAVING NEW TEAM for region #{region_idx}, seed: #{seeding_hash[:seed]}, name: #{team.name}, short: #{team.short_name}")
47
+ team.save!
48
+ end
44
49
  existing_region = @pool.region_seedings.find{|rn, rs| rn == region_name}
45
50
  existing_team = nil
46
51
  if existing_region
@@ -56,10 +61,12 @@ class TeamsController < ApplicationController
56
61
  existing_seeding.save!
57
62
  end
58
63
  else
64
+ logger.debug("SAVING NEW SEEDING for region #{region_idx}, seed: #{seeding_hash[:seed]}, team name: #{team.name}, short: #{team.short_name}, team id: #{team.id}")
59
65
  @pool.seedings.create(:team_id => team.id, :region => region_name, :seed => seeding_hash[:seed])
60
66
  end
61
67
  end
62
- @pool.save
68
+ @pool.save!
69
+ end
63
70
  if @pool.ready?
64
71
  @pool.initialize_tournament_pool
65
72
  @pool.save
@@ -31,6 +31,21 @@
31
31
  <tr>
32
32
  <td>
33
33
  Payouts
34
+ <a class="info" href="#">?
35
+ <span>
36
+ <small>
37
+ Payouts have a rank, amount and kind. The rank is either a number or
38
+ the letter L. Rank 1 defines the payout for 1st place, rank 2 for
39
+ 2nd place and so on. Rank L defines the payout for the last place
40
+ entry and is optional. The amount of the payout is a number. Its
41
+ meaning depends on the kind of the payout. If the kind is '%', then
42
+ the amount is a percentage of the total entry fees collected. If
43
+ the kind is '$', then the amount is a fixed dollar amount. This lets
44
+ you have payouts for the pool that give the last place entry the
45
+ entry fee back.
46
+ </small>
47
+ </span>
48
+ </a>
34
49
  </td>
35
50
  <td>
36
51
  <table border="0">
@@ -2,6 +2,7 @@
2
2
  <head>
3
3
  <title><%=TOURNAMENT_TITLE%></title>
4
4
  <%= stylesheet_link_tag 'main' %>
5
+ <%= stylesheet_link_tag 'reports' %>
5
6
  </head>
6
7
  <body>
7
8
  <div id="wrap">
@@ -2,21 +2,36 @@
2
2
 
3
3
  <% if Pool.active_pools.size > 0 %>
4
4
  <% Pool.active_pools.each do |pool| -%>
5
- <p>
6
- <%= pool.name %>
5
+ <div class="poollistblock">
6
+ <span class="poollisthead"><%= pool.name %></span>
7
7
  <small>
8
8
  <% if current_user && pool.user_id == current_user.id %>
9
9
  &nbsp;
10
10
  <%= link_to '[Edit]', :controller => 'admin', :action => 'pool', :id => pool.id %>
11
11
  <%= link_to '[Entries]', :controller => 'admin', :action => 'entries', :id => pool.id %>
12
12
  <% end %>
13
- <%= link_to '[Reports]', "/reports/#{pool.id}"%>
13
+ <%= link_to '[Leader Board]', :controller => 'reports', :action => 'show', :id => pool.id, :report => 'leader' %>
14
+ <%= link_to '[Reports]', :controller => 'reports', :action => 'show', :id => pool.id %>
14
15
  </small>
15
- <br/>
16
- Starts: <%= pool.starts_at.to_date.to_formatted_s(:short)%>
16
+ <div class="poollistinfo">
17
+ <div class="poollistinfodetail">
18
+ Starts: <%= pool.starts_at.to_date.to_formatted_s(:long)%>
17
19
  Pending Entries: <%= pool.pending_entries.size%>
18
20
  Total Entries: <%= pool.user_entries.size%>
19
- <br/>
21
+ </div>
22
+ <div class="poollistinfodetail">
23
+ Entry Fee: $<%=pool.fee%>
24
+ </div>
25
+ <div class="poollistinfodetail">
26
+ Payouts:
27
+ <% pool.payouts.delete_if{|p| p.kind.blank?}.sort_by {|p| p.rank }.each do |p| -%>
28
+ <%=p.rank != 'L' ? p.rank.to_i.ordinal : 'Last'%>: <%= p.kind if p.kind == '$'%><%=p.payout%><%=p.kind if p.kind != '$'%>&nbsp;&nbsp;
29
+ <% end -%>
30
+ </div>
31
+ <div class="poollistinfodetail">
32
+ Scoring: <%=pool.pool.scoring_strategy.description%>
33
+ </div>
34
+ <div class="poollistinfodetail">
20
35
  <% if current_user -%>
21
36
  Entries for <%= current_user.login%>: <%= link_to pool.entries_for(current_user).size, :controller => 'entry', :action => 'index', :id => pool.id %>
22
37
  <% if pool.accepting_entries? -%>
@@ -26,11 +41,13 @@ Entries for <%= current_user.login%>: <%= link_to pool.entries_for(current_user)
26
41
  <% else -%>
27
42
  <i>To enter this pool, please <%= link_to 'login', '/login'%> or <%= link_to 'signup', '/signup'%></i>
28
43
  <% end -%>
29
- </p>
44
+ </div>
45
+ </div>
46
+ </div>
30
47
  <% end -%>
31
48
  <% else -%>
32
- <p>
49
+ <div>
33
50
  There are no active pools. Please come back in a bit or contact
34
51
  an administrator.
35
- </p>
52
+ </div>
36
53
  <% end -%>
@@ -0,0 +1,80 @@
1
+ <% if show_header %>
2
+ <h1>Leader Report</h1>
3
+ <ul>
4
+ <li>Total games played: <%= pool.tournament_entry.picks.games_played %></li>
5
+ <% if pool.tournament_entry.picks.complete? %>
6
+ <li>Champion: <%=pool.tournament_entry.picks.champion.name%></li>
7
+ <% end %>
8
+ <li>Pool Tie Break: <%=pool.tournament_entry.tie_breaker || '-' %></li>
9
+ <li>Number of entries: <%=pool.entries.size%></li>
10
+ </ul>
11
+ <% end %>
12
+ <%
13
+ current_rank = 1
14
+ if pool.entries.size > 0
15
+ %>
16
+ <table class="report">
17
+ <thead>
18
+ <tr>
19
+ <td rowspan="2">Rank</td>
20
+ <td rowspan="2">Current<br/>Score</td>
21
+ <td rowspan="2">Max Score</td>
22
+ <td rowspan="2">Entry Name</td>
23
+ <td rowspan="2">Champ<br/>Alive?</td>
24
+ <td rowspan="2">Tie<br/>Break</td>
25
+ <td colspan="6">Round Scores</td>
26
+ </tr>
27
+ <tr>
28
+ <td>1</td>
29
+ <td>2</td>
30
+ <td>3</td>
31
+ <td>4</td>
32
+ <td>5</td>
33
+ <td>6</td>
34
+ </tr>
35
+ </thead>
36
+ <tbody>
37
+ <%
38
+ pool.entries.sort do |e1, e2|
39
+ s1 = e1.picks.score_against(pool.tournament_entry.picks, pool.scoring_strategy)
40
+ s2 = e2.picks.score_against(pool.tournament_entry.picks, pool.scoring_strategy)
41
+ if s1 == s2 && pool.tournament_entry.tie_breaker
42
+ s1 = 0 - (e1.tie_breaker - pool.tournament_entry.tie_breaker).abs
43
+ s2 = 0 - (e2.tie_breaker - pool.tournament_entry.tie_breaker).abs
44
+ end
45
+ s2 <=> s1
46
+ end.inject(nil) do |last_entry, entry|
47
+ total = entry.picks.score_against(pool.tournament_entry.picks, pool.scoring_strategy)
48
+ max = entry.picks.maximum_score(pool.tournament_entry.picks, pool.scoring_strategy)
49
+ champ = entry.picks.champion
50
+ round_scores = []
51
+ 1.upto(pool.tournament_entry.picks.rounds) do |round|
52
+ scores = entry.picks.scores_for_round(round, pool.tournament_entry.picks, pool.scoring_strategy)
53
+ round_scores << scores.inject(0) {|sum, arr| sum += (arr[0] ? arr[0] : 0)}
54
+ end
55
+ rank_display = nil
56
+ if last_entry && !pool.tournament_entry.tie_breaker && total == last_entry.bracket.score_against(pool.tournament_entry.picks, pool.scoring_strategy)
57
+ rank_display = 'TIE'
58
+ else
59
+ rank_display = "%4d" % current_rank
60
+ end
61
+ %>
62
+ <tr class="<%=cycle('even', 'odd', :name => 'rtclass')%>">
63
+ <td><%=rank_display%></td>
64
+ <td><%=total%></td>
65
+ <td><%=max%></td>
66
+ <td><%=entry.name%></td>
67
+ <td><%=champ.short_name%> <%=pool.tournament_entry.picks.still_alive?(champ) ? 'Y' : 'N'%></td>
68
+ <td><%=entry.tie_breaker || '-'%></td>
69
+ <% round_scores.each do |rs| %>
70
+ <td><%=rs%></td>
71
+ <% end %>
72
+ </tr>
73
+ <%
74
+ current_rank += 1
75
+ entry
76
+ end
77
+ end
78
+ %>
79
+ </tbody>
80
+ </table>
@@ -1,11 +1,17 @@
1
+ <% if report == 'leader' %>
2
+ <%= render :partial => 'leader', :locals => {:pool => pool, :show_header => true}%>
3
+ <br/>
4
+ <br/>
5
+ <% else %>
1
6
  <h2><%=report.capitalize%> Report</h2>
2
7
  <%
3
8
  report_output = ''
4
9
  report_method = "#{report}_report".to_sym
5
- @pool.pool.send(report_method, report_output)
10
+ pool.send(report_method, report_output)
6
11
  %>
7
12
  <pre>
8
13
  <small>
9
14
  <%= report_output %>
10
15
  </small>
11
16
  </pre>
17
+ <% end %>
@@ -7,6 +7,6 @@
7
7
  </ul>
8
8
  <div id="report">
9
9
  <% if params[:report] -%>
10
- <%= render :partial => "reports/report", :locals => {:report => params[:report]}%>
10
+ <%= render :partial => "reports/report", :locals => {:report => params[:report], :pool => @pool.pool}%>
11
11
  <% end -%>
12
12
  </div>
@@ -0,0 +1,12 @@
1
+ # Add ordinal method to Numeric class
2
+ class Numeric
3
+ def ordinal
4
+ cardinal = self.to_i.abs
5
+ if (10...20).include?(cardinal) then
6
+ cardinal.to_s << 'th'
7
+ else
8
+ cardinal.to_s << %w{th st nd rd th th th th th th}[cardinal % 10]
9
+ end
10
+ end
11
+ end
12
+
Binary file
@@ -0,0 +1,13 @@
1
+ class ChangeIllinoisShortName < ActiveRecord::Migration
2
+ def self.up
3
+ t = Team.find_by_name("Illinois")
4
+ if t
5
+ t.short_name = "Ill"
6
+ t.save!
7
+ end
8
+ end
9
+
10
+ def self.down
11
+ # Not reversible
12
+ end
13
+ end
data/webgui/db/schema.rb CHANGED
@@ -9,7 +9,7 @@
9
9
  #
10
10
  # It's strongly recommended to check this file into your version control system.
11
11
 
12
- ActiveRecord::Schema.define(:version => 20090301090511) do
12
+ ActiveRecord::Schema.define(:version => 20090316023841) do
13
13
 
14
14
  create_table "entries", :force => true do |t|
15
15
  t.string "name", :limit => 64, :null => false
Binary file
@@ -11,6 +11,22 @@ h1 {
11
11
  font-size: 24px;
12
12
  color: gray;
13
13
  }
14
+ .poollistblock {
15
+ margin-left: 10px;
16
+ }
17
+ .poollistinfo {
18
+ margin-left: 20px;
19
+ font-size: small;
20
+ }
21
+ .poollistinfodetail {
22
+ margin-left: 40px;
23
+ text-indent: -40px;
24
+ }
25
+ .poollisthead {
26
+ font-size: 14px;
27
+ font-weight: bold;
28
+ color: green;
29
+ }
14
30
  #wrap {
15
31
  margin:0 auto;
16
32
  width:auto;
@@ -142,3 +158,26 @@ div.auto_complete ul strong.highlight {
142
158
  padding:0;
143
159
  }
144
160
 
161
+ /* CSS Tooltips */
162
+ a.info {
163
+ position:relative; /*this is the key*/
164
+ z-index:24;
165
+ text-decoration:none
166
+ }
167
+
168
+ a.info:hover {
169
+ z-index:25;
170
+ }
171
+
172
+ a.info span {
173
+ display: none
174
+ }
175
+
176
+ a.info:hover span { /*the span will display just on :hover state*/
177
+ display:block;
178
+ position:absolute;
179
+ top:-2em; left:2em; width:400px;
180
+ border:1px solid #0cf;
181
+ padding: 5px;
182
+ background-color:#cff; color:#000;
183
+ }
@@ -0,0 +1,26 @@
1
+ table.report {
2
+ border-spacing: 0px;
3
+ border-width: 2px;
4
+ border-color: black;
5
+ border-style: solid;
6
+ border-collapse: separate;
7
+ text-align: center;
8
+ }
9
+ table.report td {
10
+ padding: 5px;
11
+ border-bottom: 2px solid black;
12
+ }
13
+ table.report thead {
14
+ background: lightblue;
15
+ border-width: 2px;
16
+ border-color: black;
17
+ border-style: solid;
18
+ font-weight: bold;
19
+ vertical-align: bottom;
20
+ }
21
+ table.report tbody tr.even {
22
+ background: lightyellow;
23
+ }
24
+ table.report tbody tr.odd {
25
+ background: white;
26
+ }
@@ -2239,13 +2239,13 @@ MSM:
2239
2239
  short_name: MSM
2240
2240
 
2241
2241
 
2242
- Il:
2242
+ Ill:
2243
2243
 
2244
2244
  name: Illinois
2245
2245
  created_at: 2009-03-01 04:12:30
2246
2246
  updated_at: 2009-03-01 04:12:30
2247
2247
  id: "160"
2248
- short_name: Il
2248
+ short_name: Ill
2249
2249
 
2250
2250
 
2251
2251
  Lgw:
@@ -213,4 +213,89 @@ class TeamsControllerTest < ActionController::TestCase
213
213
  assert_equal 16, pool.region_seedings[0][1].uniq.size, "OOPS! There are dupe teams in region 0 teams list"
214
214
  assert_equal input["region0"]["seedings"].map {|h| h["short_name"]}, pool.region_seedings[0][1].uniq.map{|t| t.short_name}, "Teams are out of order or otherwise not equal"
215
215
  end
216
+
217
+ test "save entire bracket with nonexistant team" do
218
+ input = {
219
+ "action"=>"change", "id"=>"1", "controller"=>"teams",
220
+ "region1"=>{"name"=>"West",
221
+ "seedings"=>[{"name"=>"Connecticut", "seed"=>"1", "short_name"=>"Con"},
222
+ {"name"=>"Memphis", "seed"=>"2", "short_name"=>"Mem"},
223
+ {"name"=>"Missouri", "seed"=>"3", "short_name"=>"Msr"},
224
+ {"name"=>"Washington", "seed"=>"4", "short_name"=>"Was"},
225
+ {"name"=>"Purdue", "seed"=>"5", "short_name"=>"Pur"},
226
+ {"name"=>"Marquette", "seed"=>"6", "short_name"=>"Mar"},
227
+ {"name"=>"California", "seed"=>"7", "short_name"=>"Cal"},
228
+ {"name"=>"BYU", "seed"=>"8", "short_name"=>"BYU"},
229
+ {"name"=>"Texas A&M", "seed"=>"9", "short_name"=>"A&M"},
230
+ {"name"=>"Maryland", "seed"=>"10", "short_name"=>"Mry"},
231
+ {"name"=>"Utah State", "seed"=>"11", "short_name"=>"USt"},
232
+ {"name"=>"Northern Iowa", "seed"=>"12", "short_name"=>"NIo"},
233
+ {"name"=>"Mississippi St.", "seed"=>"13", "short_name"=>"MiS"},
234
+ {"name"=>"Cornell", "seed"=>"14", "short_name"=>"Cor"},
235
+ {"name"=>"Cal State Northridge", "seed"=>"15", "short_name"=>"CSN"},
236
+ {"name"=>"Chattanooga", "seed"=>"16", "short_name"=>"Cht"}]},
237
+ "region2"=>{"name"=>"East",
238
+ "seedings"=>[{"name"=>"Pittsburgh", "seed"=>"1", "short_name"=>"Pit"},
239
+ {"name"=>"Duke", "seed"=>"2", "short_name"=>"Duk"},
240
+ {"name"=>"Villanova", "seed"=>"3", "short_name"=>"Vil"},
241
+ {"name"=>"Xavier", "seed"=>"4", "short_name"=>"Xav"},
242
+ {"name"=>"Florida State", "seed"=>"5", "short_name"=>"FSU"},
243
+ {"name"=>"UCLA", "seed"=>"6", "short_name"=>"ULA"},
244
+ {"name"=>"Texas", "seed"=>"7", "short_name"=>"Tex"},
245
+ {"name"=>"Oklahoma State", "seed"=>"8", "short_name"=>"OkS"},
246
+ {"name"=>"Tennessee", "seed"=>"9", "short_name"=>"Ten"},
247
+ {"name"=>"Minnesota", "seed"=>"10", "short_name"=>"Min"},
248
+ {"name"=>"Virginia Commonwealth", "seed"=>"11", "short_name"=>"VAC"},
249
+ {"name"=>"Wisconsin", "seed"=>"12", "short_name"=>"Wis"},
250
+ {"name"=>"Portland St.", "seed"=>"13", "short_name"=>"PSt"},
251
+ {"name"=>"American", "seed"=>"14", "short_name"=>"Am"},
252
+ {"name"=>"Binghamton", "seed"=>"15", "short_name"=>"Bin"},
253
+ {"name"=>"East Tennessee State", "seed"=>"16", "short_name"=>"ETS"}]},
254
+ "region3"=>{"name"=>"South",
255
+ "seedings"=>[{"name"=>"North Carolina", "seed"=>"1", "short_name"=>"UNC"},
256
+ {"name"=>"Oklahoma", "seed"=>"2", "short_name"=>"Okl"},
257
+ {"name"=>"Syracuse", "seed"=>"3", "short_name"=>"Syr"},
258
+ {"name"=>"Gonzaga", "seed"=>"4", "short_name"=>"Gon"},
259
+ {"name"=>"Illinois", "seed"=>"5", "short_name"=>"Ill"},
260
+ {"name"=>"Arizona State", "seed"=>"6", "short_name"=>"ASU"},
261
+ {"name"=>"Clemson", "seed"=>"7", "short_name"=>"Clm"},
262
+ {"name"=>"LSU", "seed"=>"8", "short_name"=>"LSU"},
263
+ {"name"=>"Butler", "seed"=>"9", "short_name"=>"But"},
264
+ {"name"=>"Michigan", "seed"=>"10", "short_name"=>"UM"},
265
+ {"name"=>"Temple", "seed"=>"11", "short_name"=>"Tem"},
266
+ {"name"=>"W. Kentucky", "seed"=>"12", "short_name"=>"WKy"},
267
+ {"name"=>"Akron", "seed"=>"13", "short_name"=>"Akr"},
268
+ {"name"=>"Stephen F. Austin", "seed"=>"14", "short_name"=>"SFA"},
269
+ {"name"=>"Morgan State", "seed"=>"15", "short_name"=>"MgS"},
270
+ {"name"=>"Radford", "seed"=>"16", "short_name"=>"Rad"}]},
271
+ "region0"=>{"name"=>"Midwest",
272
+ "seedings"=>[{"name"=>"Louisville", "seed"=>"1", "short_name"=>"Lou"},
273
+ {"name"=>"Michigan St.", "seed"=>"2", "short_name"=>"MSU"},
274
+ {"name"=>"Kansas", "seed"=>"3", "short_name"=>"Kan"},
275
+ {"name"=>"Wake Forest", "seed"=>"4", "short_name"=>"WkF"},
276
+ {"name"=>"Utah", "seed"=>"5", "short_name"=>"Uta"},
277
+ {"name"=>"West Virginia", "seed"=>"6", "short_name"=>"WVa"},
278
+ {"name"=>"Boston College", "seed"=>"7", "short_name"=>"BC"},
279
+ {"name"=>"Ohio State", "seed"=>"8", "short_name"=>"OSU"},
280
+ {"name"=>"Siena", "seed"=>"9", "short_name"=>"Sie"},
281
+ {"name"=>"USC", "seed"=>"10", "short_name"=>"USC"},
282
+ {"name"=>"Dayton", "seed"=>"11", "short_name"=>"Day"},
283
+ {"name"=>"Arizona", "seed"=>"12", "short_name"=>"UA"},
284
+ {"name"=>"Cleveland State", "seed"=>"13", "short_name"=>"ClS"},
285
+ {"name"=>"North Dakota State", "seed"=>"14", "short_name"=>"NDS"},
286
+ {"name"=>"Robert Morris", "seed"=>"15", "short_name"=>"RbM"},
287
+ {"name"=>"TBD", "seed"=>"16", "short_name"=>"TBD"}]}
288
+ }
289
+ login_as :admin
290
+ post :change, input
291
+ team = Team.find_by_name("TBD")
292
+ assert_not_nil team, "TBD team should not be null"
293
+ pool = Pool.find(1)
294
+ RAILS_DEFAULT_LOGGER.debug("POOL SEEDINGS: #{pool.seedings.inspect}")
295
+ assert_equal 64, pool.seedings.size, "OOPS! There should be 64 seedings."
296
+ team_list = pool.seedings.map{|s| s.team.name}
297
+ RAILS_DEFAULT_LOGGER.debug("POOL TEAMS: #{team_list.inspect}")
298
+ assert_equal 64, team_list.size, "OOPS! There should be 64 teams."
299
+ assert_equal 64, pool.teams.size, "OOPS! There should be 64 teams."
300
+ end
216
301
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tournament
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Douglas A. Seifert
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-11 00:00:00 -07:00
12
+ date: 2009-03-15 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -150,6 +150,7 @@ files:
150
150
  - webgui/app/views/layouts/print.html.erb
151
151
  - webgui/app/views/layouts/report.html.erb
152
152
  - webgui/app/views/pool/index.html.erb
153
+ - webgui/app/views/reports/_leader.html.erb
153
154
  - webgui/app/views/reports/_report.html.erb
154
155
  - webgui/app/views/reports/show.html.erb
155
156
  - webgui/app/views/sessions/new.html.erb
@@ -169,6 +170,7 @@ files:
169
170
  - webgui/config/initializers/inflections.rb
170
171
  - webgui/config/initializers/mime_types.rb
171
172
  - webgui/config/initializers/new_rails_defaults.rb
173
+ - webgui/config/initializers/ordinal.rb
172
174
  - webgui/config/initializers/pool.rb
173
175
  - webgui/config/initializers/site_keys.rb
174
176
  - webgui/config/locales/en.yml
@@ -193,6 +195,7 @@ files:
193
195
  - webgui/db/migrate/20090301025902_add_more_teams.rb
194
196
  - webgui/db/migrate/20090301041526_create_seedings.rb
195
197
  - webgui/db/migrate/20090301090511_create_regions.rb
198
+ - webgui/db/migrate/20090316023841_change_illinois_short_name.rb
196
199
  - webgui/db/migrate/teams.txt
197
200
  - webgui/db/pool.yml
198
201
  - webgui/db/schema.rb
@@ -226,6 +229,7 @@ files:
226
229
  - webgui/public/stylesheets/main.css
227
230
  - webgui/public/stylesheets/prince.css
228
231
  - webgui/public/stylesheets/prince_landscape.css
232
+ - webgui/public/stylesheets/reports.css
229
233
  - webgui/script/about
230
234
  - webgui/script/console
231
235
  - webgui/script/dbconsole