tournament 2.2.0 → 2.2.1
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
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.2.
|
23
|
+
PROJ.version = '2.2.1'
|
24
24
|
PROJ.group_id = 5863
|
25
25
|
|
26
26
|
PROJ.spec.opts << '--color'
|
@@ -7,12 +7,13 @@ class AdminController < ApplicationController
|
|
7
7
|
if @entry
|
8
8
|
@pool = @entry.pool
|
9
9
|
save_picks(@entry)
|
10
|
-
if @entry.save
|
10
|
+
if @entry.save(false)
|
11
11
|
@pool.pool.tournament_entry = @entry.tournament_entry
|
12
12
|
@pool.save
|
13
13
|
flash[:info] = "Tournament bracket updated."
|
14
14
|
redirect_to :action => 'bracket', :id => @pool.id
|
15
15
|
else
|
16
|
+
@pool = @pool.pool
|
16
17
|
flash[:error] = "Could not save entry."
|
17
18
|
render :action => 'bracket', :layout => 'bracket'
|
18
19
|
end
|
@@ -49,7 +50,7 @@ class AdminController < ApplicationController
|
|
49
50
|
@pool = pool.pool
|
50
51
|
@entry = Entry.find_or_initialize_by_user_id(:user_id => current_user.id, :pool_id => pool.id, :tie_break => 0, :name => 'Tournament Bracket')
|
51
52
|
@entry.bracket
|
52
|
-
@entry.save
|
53
|
+
@entry.save(false)
|
53
54
|
|
54
55
|
render :layout => 'bracket'
|
55
56
|
end
|
@@ -9,6 +9,7 @@
|
|
9
9
|
|
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
|
+
<%= link_to '[Bracket]', :controller => 'admin', :action => 'bracket', :id => pool.id %>
|
12
13
|
<% end %>
|
13
14
|
<%= link_to '[Leader Board]', :controller => 'reports', :action => 'show', :id => pool.id, :report => 'leader' %>
|
14
15
|
<%= link_to '[Reports]', :controller => 'reports', :action => 'show', :id => pool.id %>
|
@@ -24,8 +25,10 @@ Entry Fee: $<%=pool.fee%>
|
|
24
25
|
</div>
|
25
26
|
<div class="poollistinfodetail">
|
26
27
|
Payouts:
|
28
|
+
<% take = pool.user_entries.size * pool.fee.to_f -
|
29
|
+
(pool.payouts.inject(0) {|sum, p| sum += p.kind == '$' ? p.payout.to_i : 0}) %>
|
27
30
|
<% 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'%>:
|
31
|
+
<%=p.rank != 'L' ? p.rank.to_i.ordinal : 'Last'%>: $<%=p.kind == '$' ? p.payout : p.payout.to_f / 100.0 * take%>
|
29
32
|
<% end -%>
|
30
33
|
</div>
|
31
34
|
<div class="poollistinfodetail">
|
@@ -32,17 +32,19 @@ end
|
|
32
32
|
classes[idx] = "teamname "
|
33
33
|
onclicks[idx] = is_editable ? "pick(this);" : ''
|
34
34
|
if winner != :unk
|
35
|
+
real_winner = @pool.tournament_entry.picks.winner(round, game)
|
35
36
|
contents[idx] = winner.short_name
|
36
37
|
teams[idx] = winner.short_name
|
37
38
|
onmouseovers[idx] = active_mouse_over;
|
38
39
|
onmouseouts[idx] = active_mouse_out;
|
39
|
-
incorrect =
|
40
|
+
incorrect = real_winner != :unk && real_winner != winner
|
40
41
|
if incorrect
|
41
42
|
classes[idx] += 'missedpick '
|
42
43
|
else
|
43
|
-
|
44
|
-
if bracket_winner == winner
|
44
|
+
if real_winner != :unk && real_winner == winner
|
45
45
|
classes[idx] += 'correctpick '
|
46
|
+
elsif !@pool.tournament_entry.picks.still_alive?(winner)
|
47
|
+
classes[idx] += 'missedpick '
|
46
48
|
else
|
47
49
|
classes[idx] += 'pendingpick '
|
48
50
|
end
|
@@ -56,6 +58,7 @@ end
|
|
56
58
|
%>
|
57
59
|
<%= error_messages_for 'entry' %>
|
58
60
|
<% form_for(@entry, :url => {:action => 'edit', :id => @entry.id}, :html => {:onSubmit => (is_editable ? 'return submitPicks(this);' : 'return false')}) do |f| -%>
|
61
|
+
<div style="float: left">
|
59
62
|
<table border="0">
|
60
63
|
<tr>
|
61
64
|
<td><%= f.label :name, "Entry Name"%></td><td><%= f.text_field :name %></td>
|
@@ -63,19 +66,21 @@ end
|
|
63
66
|
<tr>
|
64
67
|
<td><%= f.label :tie_break, 'Tie Breaker'%></td><td><%= f.text_field :tie_break %></td>
|
65
68
|
</tr>
|
66
|
-
|
67
|
-
|
69
|
+
</table>
|
70
|
+
</div>
|
71
|
+
<div style="float: left">
|
68
72
|
<small>
|
69
73
|
Current Score: <%= @entry.bracket.score_against(@pool.tournament_entry.picks, @pool.scoring_strategy) %> Max. Possible Score: <%= @entry.bracket.maximum_score(@pool.tournament_entry.picks, @pool.scoring_strategy) %>
|
70
74
|
</small>
|
71
|
-
</
|
72
|
-
</table>
|
75
|
+
</div>
|
73
76
|
<input type="hidden" name="pool_id" value="<%=@entry.pool_id%>">
|
74
77
|
<input type="hidden" name="picks" id="picks" value="">
|
75
78
|
<% if is_editable %>
|
79
|
+
<div style="clear: both">
|
76
80
|
<input type="Submit" value="Save Changes">
|
77
81
|
<%= submit_tag 'Cancel Changes', :name => 'cancel', :confirm => 'Are you sure?'%>
|
78
82
|
<%= submit_tag 'Reset Picks', :name => 'reset', :confirm => 'Are you sure? Resetting will clear all picks and start the bracket over from scratch!'%>
|
83
|
+
</div>
|
79
84
|
<% end -%>
|
80
85
|
<% end -%>
|
81
86
|
<TABLE cellspacing=0 class="bracket">
|
Binary file
|
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.2.
|
4
|
+
version: 2.2.1
|
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-
|
12
|
+
date: 2009-03-19 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|