tournament 3.3.2 → 3.3.3

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,3 +1,6 @@
1
+ == 3.3.3 / 2010-03-21
2
+ * Show link to possibility report if stats file exists.
3
+
1
4
  == 3.3.2 / 2010-03-17
2
5
  * More regressions: Fix Tourny Bracket link when logged in as pool owner.
3
6
  Fix create entry to set the user_id so the new permissions checking actually
data/lib/tournament.rb CHANGED
@@ -7,7 +7,7 @@ unless defined? Tournament
7
7
  module Tournament
8
8
 
9
9
  # :stopdoc:
10
- VERSION = '3.3.2'
10
+ VERSION = '3.3.3'
11
11
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
12
12
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
13
13
  # :startdoc:
data/pool.dat ADDED
Binary file
@@ -3,19 +3,27 @@ class AdminController < ApplicationController
3
3
  include SavesPicks
4
4
 
5
5
  def edit
6
- @entry = Entry.find_by_user_id(current_user.id)
6
+ @entry = Entry.find(params[:id])
7
7
  if @entry
8
8
  @pool = @entry.pool
9
- save_picks(@entry)
10
- if @entry.save(false)
9
+ if params[:reset] == 'Reset Picks'
10
+ @entry.reset
11
+ flash[:info] = "Tournament bracket reset."
12
+ else
13
+ save_picks(@entry)
14
+ flash[:info] = "Tournament bracket updated."
15
+ end
16
+ if @entry.save_with_validation(false)
11
17
  @pool.pool.tournament_entry = @entry.tournament_entry
12
18
  @pool.save
13
- flash[:info] = "Tournament bracket updated."
14
19
  redirect_to :action => 'bracket', :id => @pool.id
20
+ return
15
21
  else
16
22
  @pool = @pool.pool
23
+ flash[:info] = nil
17
24
  flash[:error] = "Could not save entry."
18
25
  render :action => 'bracket', :layout => 'bracket'
26
+ return
19
27
  end
20
28
  else
21
29
  flash[:error] = "Tournament bracket has not yet been initialized."
@@ -3,6 +3,7 @@ class ReportsController < ApplicationController
3
3
  layout 'report'
4
4
  def show
5
5
  @pool = Pool.find(params[:id])
6
+ @has_poss_stats = File.exist?(self.stats_data_file(@pool.id))
6
7
  if params[:report] == 'possibility'
7
8
  possibility
8
9
  end
@@ -5,7 +5,7 @@
5
5
  <% if @pool.started? -%>
6
6
  <li><%= link_to 'Score', :report => 'score'%></li>
7
7
  <li><%= link_to 'Leader', :report => 'leader'%></li>
8
- <% if @pool.pool.tournament_entry.picks.teams_left <= 16 %>
8
+ <% if @has_poss_stats %>
9
9
  <li><%= link_to 'Possibility', :report => 'possibility'%></li>
10
10
  <% end %>
11
11
  <% if @pool.pool.tournament_entry.picks.teams_left <= 4 %>
@@ -2,7 +2,7 @@
2
2
  <i>Need help?</i> Contact an admin ...
3
3
  <ul>
4
4
  <% Role[:admin].users.each do |admin| -%>
5
- <li><%= admin.name %> <%= link_to admin.email, "mailto:#{admin.email}" %>
5
+ <li><%= admin.name %> <%= link_to admin.email, "mailto:#{admin.email}" %></li>
6
6
  <% end -%>
7
7
  </ul>
8
8
  </p>
@@ -95,10 +95,11 @@ Current Score: <%= @entry.bracket.score_against(@pool.tournament_entry.picks, @p
95
95
  <TR>
96
96
  <TD class="space" colspan="17">&nbsp;</TD>
97
97
  <!-- SEED 1 TOP 1/33 -->
98
+ </TR>
98
99
  <TR>
99
100
  <TD class="space">&nbsp;</TD>
100
101
  <TD class="odd">
101
- <span class="<%=classes[1]%>" id="<%=ids[1]%>" team="<%=teams[1]%>" onclick="<%=onclicks[1]%>" onmouseover="<%=onmouseovers[1]%>" onmouseout="<%=onmouseouts[1]%>"><%=contents[1]%></span>
102
+ <span class="<%=classes[1].strip%>" id="<%=ids[1]%>" team="<%=teams[1]%>" onclick="<%=onclicks[1]%>" onmouseover="<%=onmouseovers[1]%>" onmouseout="<%=onmouseouts[1]%>"><%=contents[1]%></span>
102
103
  </TD>
103
104
  <TD class="space">&nbsp;</TD>
104
105
  <TD class="space">&nbsp;</TD>
data/webgui/lib/prince.rb CHANGED
@@ -25,6 +25,7 @@ class Prince
25
25
  def initialize()
26
26
  # Finds where the application lives, so we can call it.
27
27
  @exe_path = defined?(PRINCE_PATH) ? PRINCE_PATH : `which prince`.chomp
28
+ @exe_path = 'no prince' if @exe_path.blank?
28
29
  @style_sheets = ''
29
30
  @log_file = "#{RAILS_ROOT}/log/prince.log"
30
31
  end
@@ -8,3 +8,12 @@ user1_entry1:
8
8
  user_id: 1
9
9
  pool_id: 2
10
10
  completed: false
11
+ pool2_tournament_entry:
12
+ id: 2
13
+ name: Tournament Bracket
14
+ created_at: 2009-01-01 05:00
15
+ updated_at: 2009-01-01 05:00
16
+ tie_break:
17
+ user_id: 4
18
+ pool_id: 2
19
+ completed: false
@@ -9,6 +9,7 @@ one:
9
9
  two:
10
10
  id: 2
11
11
  name: Test Pool 2
12
+ user_id: 4
12
13
  data:
13
14
  started: false
14
15
  starts_at: <%= Time.now + 5.days %>
@@ -9,7 +9,7 @@ class EntryControllerTest < ActionController::TestCase
9
9
  assert pool.accepting_entries?, "Pool with id = 4 should be taking entries."
10
10
  post(:edit, {:picks => "111000000000000000000000000000000000000000000000000000000000000",
11
11
  :id => 1, :entry => {:name => 'Test', :tie_break => 42}, :pool_id => 2})
12
- assert_redirected_to :action => 'show'
12
+ assert_redirected_to :controller => 'entry', :action => 'show', :id => 1
13
13
  assert_nil flash[:error]
14
14
  assert_equal "Changes were saved.", flash[:info]
15
15
  assert_equal "You still have remaining games in this entry to pick.", flash[:notice]
@@ -25,6 +25,35 @@ class EntryControllerTest < ActionController::TestCase
25
25
  assert_equal "You can't make changes to your entry, the pool has already started.", flash[:error]
26
26
  end
27
27
 
28
+ test "can edit new entry" do
29
+ login_as :quentin
30
+ pool = Pool.find(2)
31
+ get :new, :id => pool.id
32
+ entry = assigns['entry']
33
+ assert_not_nil entry, "Entry should be set"
34
+ assert entry.new_record?, "Entry should be new, not saved"
35
+ assert_select "span[class~='teamname']" do |elems|
36
+ elems.each do |elem|
37
+ assert elem.attributes["onclick"].length() > 0, "There should be onclick handlers on the teamname spans."
38
+ end
39
+ end
40
+ end
41
+
42
+ test "can not edit tournament entry" do
43
+ login_as :quentin
44
+ pool = Pool.find(2)
45
+ get :show, :id => pool.tournament_entry.id
46
+ entry = assigns['entry']
47
+ assert_not_nil entry, "Entry should be set"
48
+ assert !entry.new_record?, "Entry should not be new"
49
+ assert_select "span[class~='teamname']" do |elems|
50
+ elems.each do |elem|
51
+ assert elem.attributes["onclick"].length() == 0, "There should not be onclick handlers on the teamname spans."
52
+ end
53
+ end
54
+ end
55
+
56
+
28
57
  test "entry can change name" do
29
58
  login_as :quentin
30
59
  pool = Pool.find(2)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 3
7
7
  - 3
8
- - 2
9
- version: 3.3.2
8
+ - 3
9
+ version: 3.3.3
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-17 00:00:00 -07:00
17
+ date: 2010-03-21 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -106,6 +106,7 @@ files:
106
106
  - lib/tournament/scoring_strategy.rb
107
107
  - lib/tournament/team.rb
108
108
  - lib/tournament/webgui_installer.rb
109
+ - pool.dat
109
110
  - spec/spec_helper.rb
110
111
  - spec/tournament_spec.rb
111
112
  - static/shoes-icon.png