tournament 2.1.0 → 2.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 +8 -2
- data/README.txt +16 -0
- data/Rakefile +1 -1
- data/webgui/app/models/entry.rb +14 -0
- data/webgui/db/test.sqlite3 +0 -0
- data/webgui/test/functional/entry_controller_test.rb +27 -0
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
+
== 2.1.1 / 2009-03-16
|
2
|
+
* Fix bug when changing entry name after it has been completed
|
3
|
+
and therefore added to the backing Tournament::Pool object
|
4
|
+
* Another release forthcoming when play-in game is decided.
|
5
|
+
|
1
6
|
== 2.1.0 / 2009-03-15
|
2
7
|
* Update for 2009 NCAA tournament seedings
|
8
|
+
* Update for 2009 NCAA tournament seedings
|
3
9
|
* Leader board report is HTML instead of text
|
4
10
|
* Minor formatting changes for main page
|
5
|
-
*
|
11
|
+
* Another release forthcoming when play-in game is decided.
|
6
12
|
|
7
13
|
== 2.0.0 / 2009-03-12
|
8
14
|
* Release Rails GUI for self-service entries and admin
|
@@ -14,7 +20,7 @@
|
|
14
20
|
http://blogs.tnr.com/tnr/blogs/the_plank/archive/2008/03/27/ncaa-pool-scoring-system-rant.aspx
|
15
21
|
for details.
|
16
22
|
* Many library improvements and refactorings.
|
17
|
-
*
|
23
|
+
* Another release forthcoming with final 2009 NCAA tournament seedings forthcoming
|
18
24
|
|
19
25
|
== 1.1.1 / 2008-07-07
|
20
26
|
* Update rake tasks to bones-2.0.2
|
data/README.txt
CHANGED
@@ -211,6 +211,22 @@ name, "email" for the administrators email address, "name" for the
|
|
211
211
|
admin user's name (eg, "Joe Admin"), and "password" for the desired
|
212
212
|
admin account password
|
213
213
|
|
214
|
+
=== UPDATING THE WEB GUI:
|
215
|
+
|
216
|
+
If the tournament gem is updated, you can pull in the changes as follows:
|
217
|
+
|
218
|
+
1. Update your tournament gem
|
219
|
+
|
220
|
+
sudo gem update tournament
|
221
|
+
|
222
|
+
2. Rerun the same pool install_webgui command you used to install originally
|
223
|
+
|
224
|
+
3. Pull in any released db migrations:
|
225
|
+
|
226
|
+
cd $install_dir; RAILS_ENV=production rake db:migrate
|
227
|
+
|
228
|
+
4. Reload your web server configuration (nginx, apache, etc.)
|
229
|
+
|
214
230
|
=== USING THE WEB GUI:
|
215
231
|
|
216
232
|
Load the entry page in your brower. Log in as the admin user you
|
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.1.
|
23
|
+
PROJ.version = '2.1.1'
|
24
24
|
PROJ.group_id = 5863
|
25
25
|
|
26
26
|
PROJ.spec.opts << '--color'
|
data/webgui/app/models/entry.rb
CHANGED
@@ -4,6 +4,7 @@ class Entry < ActiveRecord::Base
|
|
4
4
|
validates_uniqueness_of :name
|
5
5
|
validates_presence_of :tie_break
|
6
6
|
validates_presence_of :user_id
|
7
|
+
attr_accessor :old_name
|
7
8
|
|
8
9
|
# Override bracket to resolve the db blob to an object
|
9
10
|
def bracket
|
@@ -30,11 +31,24 @@ class Entry < ActiveRecord::Base
|
|
30
31
|
|
31
32
|
def after_save
|
32
33
|
if self.bracket.complete? && self.user_id != self.pool.user_id
|
34
|
+
if self.old_name
|
35
|
+
# We changed entry names, so pull the old one out of the
|
36
|
+
# backing pool
|
37
|
+
self.pool.pool.entries.delete_if{|e| self.old_name == e.name}
|
38
|
+
end
|
33
39
|
self.pool.pool.update_entry(self.tournament_entry)
|
34
40
|
self.pool.save!
|
35
41
|
end
|
36
42
|
end
|
37
43
|
|
44
|
+
# Override name= to record name changes
|
45
|
+
def name=(new_name)
|
46
|
+
if new_name != self.name
|
47
|
+
self.old_name = self.name
|
48
|
+
self.write_attribute(:name, new_name)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
38
52
|
def tournament_entry
|
39
53
|
@tournament_entry ||= Tournament::Entry.new(self.name, self.bracket, self.tie_break)
|
40
54
|
end
|
data/webgui/db/test.sqlite3
CHANGED
Binary file
|
@@ -24,4 +24,31 @@ class EntryControllerTest < ActionController::TestCase
|
|
24
24
|
assert_redirected_to :action => 'show'
|
25
25
|
assert_equal "You can't make changes to your entry, the pool has already started.", flash[:error]
|
26
26
|
end
|
27
|
+
|
28
|
+
test "entry can change name" do
|
29
|
+
login_as :quentin
|
30
|
+
pool = Pool.find(2)
|
31
|
+
# SHould have 1 pending entry
|
32
|
+
assert_equal 1, pool.pending_entries.size, "Should have 1 pending entry"
|
33
|
+
assert_equal 1, pool.user_entries.size, "Should have 1 user entry"
|
34
|
+
post(:edit, {:picks => "111222222222222222222222222222222222222222222222222222222222222",
|
35
|
+
:id => 1, :entry => {:name => 'Test', :tie_break => 42}, :pool_id => 2})
|
36
|
+
# Should have 1 completed entry
|
37
|
+
pool = Pool.find(2)
|
38
|
+
assert_equal 0, pool.pending_entries.size, "Should have 0 pending entries."
|
39
|
+
assert_equal 1, pool.user_entries.size, "Should have 1 user entry."
|
40
|
+
assert_equal pool.user_entries.size, pool.pool.entries.size, "AR and backing pool should have same number of entries"
|
41
|
+
assert_equal ['Test'], pool.user_entries.map{|e| e.name}
|
42
|
+
assert_equal ['Test'], pool.pool.entries.map{|e| e.name}
|
43
|
+
|
44
|
+
# Change entry name
|
45
|
+
post(:edit, {:picks => "111222222222222222222222222211111222222222222222222222222222222",
|
46
|
+
:id => 1, :entry => {:name => 'New Name', :tie_break => 42}, :pool_id => 2})
|
47
|
+
pool = Pool.find(2)
|
48
|
+
assert_equal 0, pool.pending_entries.size, "Should have 0 pending entries."
|
49
|
+
assert_equal 1, pool.user_entries.size, "AR pool should have 1 user entry."
|
50
|
+
assert_equal 1, pool.pool.entries.size, "Backing pool should have 1 user entry."
|
51
|
+
assert_equal ['New Name'], pool.user_entries.map{|e| e.name}
|
52
|
+
assert_equal ['New Name'], pool.pool.entries.map{|e| e.name}
|
53
|
+
end
|
27
54
|
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.1.
|
4
|
+
version: 2.1.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-16 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|