tournament 2.4.0 → 2.5.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,5 +1,11 @@
1
+ == 2.5.0 / 2009-03-23
2
+ * Add rake task for generating possibility report data file.
3
+ * Bugfix for final four report: work around fact that web gui
4
+ sets things as strings that it should not.
5
+
1
6
  == 2.4.0 / 2009-03-23
2
7
  * Hook up possibility report.
8
+ * Limit recap mails to pool participants.
3
9
 
4
10
  == 2.3.0 / 2009-03-20
5
11
  * Add ability for admin to send emails to participants. Needs work.
data/README.txt CHANGED
@@ -264,6 +264,23 @@ on the right sidebar to record the winning teams.
264
264
 
265
265
  Use the report links to run reports, etc.
266
266
 
267
+ ==== POSSIBILITY REPORT
268
+
269
+ After about 21 teams are left in the tournament, you can run the
270
+ possibility report. This report runs through every possible way the
271
+ tournament can come out and ranks each entry against the possiblity.
272
+ The report lists the "chance to win" for each entry. The chance
273
+ to win is the percentage of possible outcomes that would result in
274
+ that entry coming in first.
275
+
276
+ The possibility report requires that a rake task be run on the
277
+ web server. It is very processor intensive and can take a long
278
+ time to complete. To generate the possibility report data file,
279
+ run the following command from the web gui install directory
280
+ on the server:
281
+
282
+ RAILS_ENV=production rake report:possibilities
283
+
267
284
  == SHOES GUI:
268
285
 
269
286
  A GUI for filling out tournment bracket entries is included and is run
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ task :default => 'spec:run'
11
11
 
12
12
  depend_on 'main'
13
13
  depend_on 'rake'
14
- depend_on 'rails', '2.2.2'
14
+ depend_on 'rails', '=2.2.2'
15
15
  depend_on 'sqlite3-ruby'
16
16
 
17
17
 
@@ -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.4.0'
23
+ PROJ.version = '2.5.0'
24
24
  PROJ.group_id = 5863
25
25
 
26
26
  PROJ.spec.opts << '--color'
@@ -467,11 +467,12 @@ class Tournament::Pool
467
467
  out << "are four or fewer teams left in the tournament." << "\n"
468
468
  return
469
469
  end
470
- total_payout = @entries.size * @entry_fee
470
+ total_payout = @entries.size * @entry_fee.to_i
471
471
  # Subtract out constant payments
472
472
  total_payout = @payouts.values.inject(total_payout) {|t, amount| t += amount if amount < 0; t}
473
473
 
474
- payout_keys = @payouts.keys.sort do |a,b|
474
+ use_payouts = @payouts.inject({}) {|h,arr| k = arr[0] != :last ? arr[0].to_i : arr[0]; h[k] = arr[1]; h}
475
+ payout_keys = use_payouts.keys.sort do |a,b|
475
476
  if Symbol === a
476
477
  1
477
478
  elsif Symbol === b
@@ -488,10 +489,10 @@ class Tournament::Pool
488
489
  end
489
490
  out << "Payouts" << "\n"
490
491
  payout_keys.each do |key|
491
- amount = if @payouts[key] > 0
492
- @payouts[key].to_f / 100.0 * total_payout
492
+ amount = if use_payouts[key] > 0
493
+ use_payouts[key].to_f / 100.0 * total_payout
493
494
  else
494
- -@payouts[key]
495
+ -use_payouts[key]
495
496
  end
496
497
  out << "%4s: $%5.2f" % [key, amount] << "\n"
497
498
  end
@@ -515,13 +516,12 @@ class Tournament::Pool
515
516
  end
516
517
  end
517
518
  finishers = {}
518
- @payouts.each do |rank, payout|
519
+ use_payouts.each do |rank, payout|
519
520
  finishers[rank] = {}
520
521
  finishers[rank][:payout] = payout
521
522
  finishers[rank][:entries] = []
522
523
  finishers[rank][:score] = 0
523
524
  end
524
- #puts "Got finishers: #{finishers.inspect}"
525
525
  index = 0
526
526
  rank = 1
527
527
  while index < @entries.size
@@ -24,19 +24,26 @@
24
24
  </tr>
25
25
  </thead>
26
26
  <tbody>
27
+ <% db_entry_ids = @pool.user_entries.inject({}) {|h,e| h[e.name] = e.id; h} %>
27
28
  <% @stats.each do |stat| -%>
28
29
  <tr class="<%=cycle('even', 'odd', :name => 'rtclass')%>">
29
- <td><%=stat.entry.name%></td>
30
- <td><%=stat.times_champ * 100.0/pool.tournament_entry.picks.number_of_outcomes%>%</td>
30
+ <td><%= link_to stat.entry.name, :controller => 'entry', :action => 'show', :id => db_entry_ids[stat.entry.name]%></td>
31
+ <td><%="%5.2f" % (stat.times_champ * 100.0/pool.tournament_entry.picks.number_of_outcomes)%>%</td>
31
32
  <td><%=stat.min_rank.ordinal%></td>
32
33
  <td><%=stat.entry.bracket.score_against(pool.tournament_entry.picks, pool.scoring_strategy)%></td>
33
34
  <td><%=stat.max_score%></td>
34
35
  <td><%=stat.entry.tie_breaker%></td>
35
36
  <td>
37
+ <% if stat.champs.size > 0 %>
38
+ <a class="info" href="#">Detail
39
+ <span class="flow">
36
40
  <% stat.champs.sort_by{|k,v| -v}.each do |team, occurrences| -%>
37
- <%=team%> <%=occurrences%> (<%="%5.2f" % (occurrences.to_f * 100.0 / stat.times_champ)%>%)
41
+ <nobr><%=team%> <%=occurrences%> (<%="%5.2f" % (occurrences.to_f * 100.0 / stat.times_champ)%>%)</nobr>
38
42
  <br/>
39
43
  <% end -%>
44
+ </span>
45
+ </a>
46
+ <% end -%>
40
47
  &nbsp;
41
48
  </td>
42
49
  </tr>
Binary file
@@ -181,3 +181,10 @@ a.info:hover span { /*the span will display just on :hover state*/
181
181
  padding: 5px;
182
182
  background-color:#cff; color:#000;
183
183
  }
184
+
185
+ /* For non fixed width popups that have left justified text.*/
186
+ a.info:hover span.flow {
187
+ width: auto;
188
+ text-align: left;
189
+ }
190
+
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.4.0
4
+ version: 2.5.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-23 00:00:00 -07:00
12
+ date: 2009-03-25 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -38,7 +38,7 @@ dependencies:
38
38
  version_requirement:
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - ">="
41
+ - - "="
42
42
  - !ruby/object:Gem::Version
43
43
  version: 2.2.2
44
44
  version: