tournament 3.1.0 → 3.1.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 +5 -0
- data/lib/tournament.rb +1 -1
- data/webgui/app/controllers/teams_controller.rb +1 -1
- data/webgui/app/controllers/users_controller.rb +2 -2
- data/webgui/app/models/pool.rb +22 -6
- data/webgui/app/views/entry/index.html.erb +6 -3
- data/webgui/app/views/layouts/default.html.erb +1 -1
- data/webgui/app/views/reports/show.html.erb +1 -1
- data/webgui/config/environments/development.rb +1 -1
- data/webgui/test/test_helper.rb +1 -1
- data/webgui/test/unit/pool_test.rb +19 -3
- metadata +3 -3
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 3.1.1 / 2009-03-13
|
2
|
+
* Bugfixes for showing add entry links. Makes sure participants can
|
3
|
+
add entries once the teams are set.
|
4
|
+
* Verbiage for pools that are over.
|
5
|
+
|
1
6
|
== 3.1.0 / 2009-03-12
|
2
7
|
* Account for multiple pools when saving/loading possibility yaml file.
|
3
8
|
* Update restful_authentication to latest version.
|
data/lib/tournament.rb
CHANGED
@@ -69,7 +69,7 @@ class UsersController < ApplicationController
|
|
69
69
|
UserMailer.deliver_password_reset_notification(user, reset_password_path(:reset_code => user.password_reset_code, :only_path => false))
|
70
70
|
end
|
71
71
|
flash[:notice] = "Reset code sent to #{params[:user][:email]}"
|
72
|
-
redirect_back_or_default(
|
72
|
+
redirect_back_or_default(root_path)
|
73
73
|
else
|
74
74
|
flash[:error] = "Please enter a valid email address"
|
75
75
|
end
|
@@ -92,7 +92,7 @@ class UsersController < ApplicationController
|
|
92
92
|
#self.current_user = @user
|
93
93
|
@user.delete_password_reset_code
|
94
94
|
flash[:notice] = "Password updated successfully for #{@user.email} - You may now log in using your new password."
|
95
|
-
redirect_back_or_default(
|
95
|
+
redirect_back_or_default(root_path)
|
96
96
|
else
|
97
97
|
render :action => :reset_password
|
98
98
|
end
|
data/webgui/app/models/pool.rb
CHANGED
@@ -36,10 +36,30 @@ class Pool < ActiveRecord::Base
|
|
36
36
|
end
|
37
37
|
|
38
38
|
# True if the number of teams in the pool is 64
|
39
|
-
def
|
39
|
+
def teams_set?
|
40
40
|
return teams.size == 64
|
41
41
|
end
|
42
42
|
|
43
|
+
# True if the pool has started
|
44
|
+
def started?
|
45
|
+
return Time.now > starts_at
|
46
|
+
end
|
47
|
+
|
48
|
+
# True if the teams have been set and the start time
|
49
|
+
# has not been reached
|
50
|
+
def accepting_entries?
|
51
|
+
teams_set? && !started?
|
52
|
+
end
|
53
|
+
|
54
|
+
# True if this pool is over, ie, the champion is known
|
55
|
+
def completed?
|
56
|
+
begin
|
57
|
+
self.pool.tournament_entry.picks.teams_left == 1
|
58
|
+
rescue Exception => e
|
59
|
+
false
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
43
63
|
def region_seedings
|
44
64
|
reg_ret = self.regions.inject([]) do |arr, r|
|
45
65
|
arr[r.position] = [r.name, Array.new(16)]
|
@@ -60,7 +80,7 @@ class Pool < ActiveRecord::Base
|
|
60
80
|
end
|
61
81
|
|
62
82
|
def initialize_tournament_pool
|
63
|
-
if self.
|
83
|
+
if self.teams_set?
|
64
84
|
@pool = Tournament::Pool.new
|
65
85
|
@pool.scoring_strategy = FormObject.class_get(@scoring_strategy || 'Tournament::ScoringStrategy::Basic').new
|
66
86
|
region_counter = 0
|
@@ -137,10 +157,6 @@ class Pool < ActiveRecord::Base
|
|
137
157
|
@payouts << PayoutData.new
|
138
158
|
end
|
139
159
|
|
140
|
-
def accepting_entries?
|
141
|
-
return ready? && Time.now < starts_at
|
142
|
-
end
|
143
|
-
|
144
160
|
def self.active_pools
|
145
161
|
Pool.find(:all, :conditions => ['active = ?', true]).reverse
|
146
162
|
end
|
@@ -15,8 +15,11 @@ You have no entries.
|
|
15
15
|
<p>
|
16
16
|
<%= link_to 'Create a new entry', :action => 'new', :id => @pool.id %>
|
17
17
|
</p>
|
18
|
-
<% elsif !@pool.
|
19
|
-
<i>This pool is not yet ready. The pool starts in <%= distance_of_time_in_words(@pool.starts_at, Time.now) %>.
|
20
|
-
|
18
|
+
<% elsif !@pool.started? -%>
|
19
|
+
<i>This pool is not yet ready. The pool starts in <%= distance_of_time_in_words(@pool.starts_at, Time.now) %>. Once all the teams in the tournament have
|
20
|
+
been selected, you will be able to create entries.</i>
|
21
|
+
<% elsif @pool.started? && !@pool.completed? -%>
|
21
22
|
<i>This pool is not accepting any more entries.</i>
|
23
|
+
<% elsif @pool.completed? -%>
|
24
|
+
<i>This pool is over.</i>
|
22
25
|
<% end -%>
|
@@ -44,7 +44,7 @@
|
|
44
44
|
<% if @pool -%>
|
45
45
|
<li> <%= link_to 'Pool', :controller => 'admin', :action => 'pool', :id => @pool.id %></li>
|
46
46
|
<li> <%= link_to 'Teams', :controller => 'teams', :action => 'choose', :id => @pool.id %></li>
|
47
|
-
<% if @pool.
|
47
|
+
<% if @pool.teams_set? %>
|
48
48
|
<li> <%= link_to 'Tournament Bracket', :controller => 'admin', :action => 'bracket', :id => @pool.id %></li>
|
49
49
|
<li> <%= link_to 'All Entries', :controller => 'admin', :action => 'entries', :id => @pool.id%></li>
|
50
50
|
<li> <%= link_to 'Reports', :controller => 'reports', :action => 'show', :id => @pool.id%></li>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<ul>
|
3
3
|
<li><%= link_to 'Region', :report => 'region'%></li>
|
4
4
|
<li><%= link_to 'Entries', :report => 'entry'%></li>
|
5
|
-
<% if @pool.
|
5
|
+
<% if @pool.started? -%>
|
6
6
|
<li><%= link_to 'Score', :report => 'score'%></li>
|
7
7
|
<li><%= link_to 'Leader', :report => 'leader'%></li>
|
8
8
|
<% if @pool.pool.tournament_entry.picks.teams_left <= 16 %>
|
data/webgui/test/test_helper.rb
CHANGED
@@ -2,7 +2,7 @@ ENV["RAILS_ENV"] = "test"
|
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
3
3
|
require 'test_help'
|
4
4
|
|
5
|
-
class
|
5
|
+
class ActiveSupport::TestCase
|
6
6
|
# Transactional fixtures accelerate your tests by wrapping each test method
|
7
7
|
# in a transaction that's rolled back on completion. This ensures that the
|
8
8
|
# test database remains unchanged so your fixtures don't have to be reloaded
|
@@ -1,8 +1,24 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class PoolTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
|
6
|
-
assert
|
4
|
+
test "new pool is not completed" do
|
5
|
+
p = Pool.new
|
6
|
+
assert !p.completed?, "new pool should not be completed"
|
7
|
+
end
|
8
|
+
test "new pool does not have teams set" do
|
9
|
+
p = Pool.new
|
10
|
+
assert !p.teams_set?, "new pool should not have teams set"
|
11
|
+
end
|
12
|
+
test "pool that has not started is accepting entries" do
|
13
|
+
p = Pool.new
|
14
|
+
p.teams = [Team.new] * 64
|
15
|
+
p.starts_at = Time.now + 2.days
|
16
|
+
assert p.accepting_entries?, "Pool with all teams that starts in future should except entries"
|
17
|
+
end
|
18
|
+
test "pool that has started is not accepting entries" do
|
19
|
+
p = Pool.new
|
20
|
+
p.teams = [Team.new] * 64
|
21
|
+
p.starts_at = Time.now - 2.days
|
22
|
+
assert !p.accepting_entries?, "Pool with all teams that starts in past should not except entries"
|
7
23
|
end
|
8
24
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 3
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 3.1.
|
8
|
+
- 1
|
9
|
+
version: 3.1.1
|
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
|
+
date: 2010-03-13 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|