tournament 3.3.3 → 4.0.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 +4 -0
- data/README.rdoc +5 -4
- data/Rakefile +1 -1
- data/lib/tournament.rb +1 -1
- data/lib/tournament/scoring_strategy.rb +18 -1
- data/webgui/app/controllers/teams_controller.rb +9 -2
- data/webgui/app/controllers/users_controller.rb +1 -1
- data/webgui/app/models/entry.rb +1 -1
- data/webgui/app/models/pool.rb +3 -3
- data/webgui/app/views/layouts/bracket.html.erb +1 -0
- data/webgui/app/views/layouts/default.html.erb +1 -0
- data/webgui/app/views/layouts/print.html.erb +1 -0
- data/webgui/app/views/layouts/report.html.erb +1 -0
- data/webgui/config/environment.rb +2 -2
- data/webgui/db/development.sqlite3 +0 -0
- data/webgui/lib/saves_picks.rb +1 -1
- data/webgui/public/images/2011FinalFour.jpg +0 -0
- data/webgui/public/stylesheets/bracket.css +1 -1
- metadata +69 -88
- data/pool.dat +0 -0
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -20,6 +20,7 @@ basketball tournament pool.
|
|
20
20
|
the entries and updating the tournament results bracket. Useful as an
|
21
21
|
adjunct to the command line script.
|
22
22
|
* FIXME: Complete the test suite for the library and command line tool
|
23
|
+
* FIXME: Can't change name of team after entries have been added
|
23
24
|
|
24
25
|
== COMMAND LINE SYNOPSIS:
|
25
26
|
|
@@ -288,7 +289,7 @@ on the server:
|
|
288
289
|
|
289
290
|
RAILS_ENV=production rake report:possibilities
|
290
291
|
|
291
|
-
== SHOES GUI:
|
292
|
+
== SHOES GUI (Deprecated):
|
292
293
|
|
293
294
|
A GUI for filling out tournment bracket entries is included and is run
|
294
295
|
by executing the program "picker". If no argument is included, a blank
|
@@ -312,9 +313,9 @@ from played to unknown outcome.
|
|
312
313
|
|
313
314
|
== WEB GUI REQUIREMENTS:
|
314
315
|
|
315
|
-
* rails (2.3.
|
316
|
+
* rails (2.3.11)
|
316
317
|
* rake (0.8.7)
|
317
|
-
* sqlite3-ruby (1.
|
318
|
+
* sqlite3-ruby (1.3.3) (default active record adapter)
|
318
319
|
|
319
320
|
== SHOES GUI REQUIREMENTS:
|
320
321
|
|
@@ -332,7 +333,7 @@ Verified working on
|
|
332
333
|
|
333
334
|
(The MIT License)
|
334
335
|
|
335
|
-
Copyright (c)
|
336
|
+
Copyright (c) 2011
|
336
337
|
|
337
338
|
Permission is hereby granted, free of charge, to any person obtaining
|
338
339
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
data/lib/tournament.rb
CHANGED
@@ -16,6 +16,22 @@ module Tournament::ScoringStrategy
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
class WorldCupSoccer
|
20
|
+
PER_ROUND = [0, 0, 1, 2, 4, 8]
|
21
|
+
def score(pick, winner, loser, round)
|
22
|
+
if winner != Tournament::Bracket::UNKNOWN_TEAM && pick == winner
|
23
|
+
return PER_ROUND[round-1]
|
24
|
+
end
|
25
|
+
return 0
|
26
|
+
end
|
27
|
+
def name
|
28
|
+
'World Cup Soccer'
|
29
|
+
end
|
30
|
+
def description
|
31
|
+
"Each correct pick is worth #{PER_ROUND.join(', ')} per round. First 2 rounds are 'dummy' rounds representing the group play."
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
19
35
|
# Class representing a scoring strategy where correct picks
|
20
36
|
# are worth 1 point each, regardless of round
|
21
37
|
class ConstantValue
|
@@ -90,7 +106,7 @@ module Tournament::ScoringStrategy
|
|
90
106
|
# Returns names of available strategies. The names returned are suitable
|
91
107
|
# for use in the strategy_for_name method
|
92
108
|
def self.available_strategies
|
93
|
-
return ['basic', 'upset', 'josh_patashnik', 'tweaked_josh_patashnik', 'constant_value']
|
109
|
+
return ['basic', 'world_cup_soccer', 'upset', 'josh_patashnik', 'tweaked_josh_patashnik', 'constant_value']
|
94
110
|
end
|
95
111
|
|
96
112
|
# Returns an instantiated strategy class for the named strategy.
|
@@ -100,3 +116,4 @@ module Tournament::ScoringStrategy
|
|
100
116
|
end
|
101
117
|
|
102
118
|
end
|
119
|
+
|
@@ -26,9 +26,13 @@ class TeamsController < ApplicationController
|
|
26
26
|
Pool.transaction do
|
27
27
|
[0,1,2,3].each do |region_idx|
|
28
28
|
region_hash = params["region#{region_idx}".to_sym]
|
29
|
+
logger.debug("Got region hash: #{region_hash}, index: #{region_idx}")
|
29
30
|
next unless region_hash
|
30
31
|
region_name = region_hash[:name]
|
31
|
-
|
32
|
+
if region_name.blank? || region_hash[:seedings].blank?
|
33
|
+
flash[:error] = "Please specify name of region #{region_idx+1}"
|
34
|
+
next
|
35
|
+
end
|
32
36
|
raise "Illegal input, seedings array contains more than 16 elements" if region_hash[:seedings].length > 16
|
33
37
|
region = Region.find_by_pool_id_and_position(@pool.id, region_idx)
|
34
38
|
if !region
|
@@ -48,7 +52,10 @@ class TeamsController < ApplicationController
|
|
48
52
|
team.save!
|
49
53
|
end
|
50
54
|
logger.debug "Finding Seeding for region #{region.name}, seed #{seeding_hash[:seed]}"
|
51
|
-
existing_seeding = @pool.seedings.
|
55
|
+
existing_seeding = @pool.seedings.find_by_region_and_seed(region.name, seeding_hash[:seed])
|
56
|
+
unless existing_seeding
|
57
|
+
existing_seeding = @pool.seedings.create(:region => region.name, :seed => seeding_hash[:seed], :team_id => team.id)
|
58
|
+
end
|
52
59
|
if existing_seeding.team_id != team.id
|
53
60
|
logger.debug " ==> TEAMS ARE DIFF, CHANGING SEEDING: #{existing_seeding.inspect}"
|
54
61
|
existing_seeding.team_id = team.id
|
@@ -82,7 +82,7 @@ class UsersController < ApplicationController
|
|
82
82
|
@user = User.find_by_password_reset_code(params[:reset_code]) unless params[:reset_code].nil?
|
83
83
|
if !@user
|
84
84
|
flash[:error] = "Reset password token invalid, please contact support."
|
85
|
-
redirect_to(
|
85
|
+
redirect_to(root_path)
|
86
86
|
return
|
87
87
|
else
|
88
88
|
@user.crypted_password = nil
|
data/webgui/app/models/entry.rb
CHANGED
data/webgui/app/models/pool.rb
CHANGED
@@ -5,14 +5,14 @@ class Pool < ActiveRecord::Base
|
|
5
5
|
validates_uniqueness_of :name
|
6
6
|
before_save :marshal_pool
|
7
7
|
belongs_to :user
|
8
|
-
has_many :entries
|
8
|
+
has_many :entries, :dependent => :destroy
|
9
9
|
has_many :user_entries, :class_name => 'Entry', :conditions => ['user_id != ?', '#{user_id}'], :include => :user, :order => 'users.login, entries.name'
|
10
10
|
has_many :users, :through => :user_entries
|
11
11
|
has_many :pending_entries, :class_name => 'Entry', :conditions => ['completed = ? and user_id != ?', false, '#{user_id}']
|
12
12
|
has_one :tournament_entry, :class_name => 'Entry', :conditions => ['user_id = \'#{user_id}\'']
|
13
|
-
has_many :seedings
|
13
|
+
has_many :seedings, :dependent => :destroy
|
14
14
|
has_many :teams, :through => :seedings
|
15
|
-
has_many :regions, :order => 'position'
|
15
|
+
has_many :regions, :order => 'position', :dependent => :destroy
|
16
16
|
|
17
17
|
# Class for collecting payout info from edit pool form
|
18
18
|
class PayoutData < FormObject
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# ENV['RAILS_ENV'] ||= 'production'
|
6
6
|
|
7
7
|
# Specifies gem version of Rails to use when vendor/rails is not present
|
8
|
-
RAILS_GEM_VERSION = '2.3.
|
8
|
+
RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION
|
9
9
|
|
10
10
|
# Bootstrap the Rails environment, frameworks, and default configuration
|
11
11
|
require File.join(File.dirname(__FILE__), 'boot')
|
@@ -27,7 +27,7 @@ Rails::Initializer.run do |config|
|
|
27
27
|
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
|
28
28
|
# config.gem "sqlite3-ruby", :lib => "sqlite3"
|
29
29
|
# config.gem "aws-s3", :lib => "aws/s3"
|
30
|
-
config.gem "tournament"
|
30
|
+
config.gem "tournament", :version => "~> 4.0.0"
|
31
31
|
|
32
32
|
# Only load the plugins named here, in the order given. By default, all plugins
|
33
33
|
# in vendor/plugins are loaded in alphabetical order.
|
Binary file
|
data/webgui/lib/saves_picks.rb
CHANGED
@@ -18,6 +18,6 @@ module SavesPicks
|
|
18
18
|
logger.debug("SAVING ENTRY PARAMS: #{params[:entry].inspect}")
|
19
19
|
entry.attributes = params[:entry]
|
20
20
|
logger.debug("DONE SAVING ENTRY PARAMS")
|
21
|
-
entry.completed =
|
21
|
+
entry.completed = bracket.complete?
|
22
22
|
end
|
23
23
|
end
|
Binary file
|
@@ -4,7 +4,7 @@ TABLE.bracket
|
|
4
4
|
BORDER-TOP: black 1px solid;
|
5
5
|
BORDER-LEFT: black 1px solid;
|
6
6
|
BORDER-BOTTOM: black 1px solid;
|
7
|
-
background: white url(../images/
|
7
|
+
background: white url(../images/2011FinalFour.jpg) center no-repeat;
|
8
8
|
}
|
9
9
|
|
10
10
|
TABLE.bracket TH.header
|
metadata
CHANGED
@@ -1,96 +1,79 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: tournament
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 3
|
7
|
-
- 3
|
8
|
-
- 3
|
9
|
-
version: 3.3.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 4.0.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Douglas A. Seifert
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2010-03-21 00:00:00 -07:00
|
12
|
+
date: 2011-03-14 00:00:00.000000000 -07:00
|
18
13
|
default_executable:
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
21
16
|
name: main
|
22
|
-
|
23
|
-
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
- 4
|
29
|
-
- 2
|
30
|
-
- 0
|
31
|
-
version: 4.2.0
|
17
|
+
requirement: &15442900 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 4.4.0
|
32
23
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: rake
|
36
24
|
prerelease: false
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
25
|
+
version_requirements: *15442900
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rake
|
28
|
+
requirement: &15442480 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
45
33
|
version: 0.8.7
|
46
34
|
type: :runtime
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: rails
|
50
35
|
prerelease: false
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
version: 2.3.
|
36
|
+
version_requirements: *15442480
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rails
|
39
|
+
requirement: &15442060 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - =
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 2.3.11
|
60
45
|
type: :runtime
|
61
|
-
version_requirements: *id003
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: bones
|
64
46
|
prerelease: false
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
version: 3.
|
47
|
+
version_requirements: *15442060
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: bones
|
50
|
+
requirement: &15441600 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 3.6.5
|
74
56
|
type: :development
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *15441600
|
59
|
+
description: ! 'Small library, command line program and Rails web GUI for managing
|
60
|
+
a NCAA
|
61
|
+
|
62
|
+
basketball tournament pool.'
|
79
63
|
email: doug@dseifert.net
|
80
|
-
executables:
|
64
|
+
executables:
|
81
65
|
- benchmark_pool
|
82
66
|
- gui.rb
|
83
67
|
- picker
|
84
68
|
- pool
|
85
69
|
extensions: []
|
86
|
-
|
87
|
-
extra_rdoc_files:
|
70
|
+
extra_rdoc_files:
|
88
71
|
- History.txt
|
89
72
|
- README.rdoc
|
90
73
|
- bin/benchmark_pool
|
91
74
|
- bin/picker
|
92
75
|
- bin/pool
|
93
|
-
files:
|
76
|
+
files:
|
94
77
|
- History.txt
|
95
78
|
- README.rdoc
|
96
79
|
- Rakefile
|
@@ -106,7 +89,6 @@ files:
|
|
106
89
|
- lib/tournament/scoring_strategy.rb
|
107
90
|
- lib/tournament/team.rb
|
108
91
|
- lib/tournament/webgui_installer.rb
|
109
|
-
- pool.dat
|
110
92
|
- spec/spec_helper.rb
|
111
93
|
- spec/tournament_spec.rb
|
112
94
|
- static/shoes-icon.png
|
@@ -183,6 +165,7 @@ files:
|
|
183
165
|
- webgui/config/initializers/site_keys.rb
|
184
166
|
- webgui/config/locales/en.yml
|
185
167
|
- webgui/config/routes.rb
|
168
|
+
- webgui/db/development.sqlite3
|
186
169
|
- webgui/db/migrate/20090216015836_create_entries.rb
|
187
170
|
- webgui/db/migrate/20090217001611_add_tie_break_to_entry.rb
|
188
171
|
- webgui/db/migrate/20090217004039_create_users.rb
|
@@ -225,6 +208,7 @@ files:
|
|
225
208
|
- webgui/public/favicon.ico
|
226
209
|
- webgui/public/images/2009FinalFour.png
|
227
210
|
- webgui/public/images/2010FinalFour.jpg
|
211
|
+
- webgui/public/images/2011FinalFour.jpg
|
228
212
|
- webgui/public/images/rails.png
|
229
213
|
- webgui/public/javascripts/application.js
|
230
214
|
- webgui/public/javascripts/bracket.js
|
@@ -361,38 +345,35 @@ files:
|
|
361
345
|
has_rdoc: true
|
362
346
|
homepage: http://www.dseifert.net/code/tournament
|
363
347
|
licenses: []
|
364
|
-
|
365
348
|
post_install_message:
|
366
|
-
rdoc_options:
|
349
|
+
rdoc_options:
|
367
350
|
- --line-numbers
|
368
351
|
- --force-update
|
369
352
|
- -W
|
370
353
|
- http://tournament.rubyforge.org/svn/trunk/%s
|
371
354
|
- --main
|
372
355
|
- README.rdoc
|
373
|
-
require_paths:
|
356
|
+
require_paths:
|
374
357
|
- lib
|
375
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
requirements:
|
384
|
-
- -
|
385
|
-
- !ruby/object:Gem::Version
|
386
|
-
|
387
|
-
- 0
|
388
|
-
version: "0"
|
358
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
359
|
+
none: false
|
360
|
+
requirements:
|
361
|
+
- - ! '>='
|
362
|
+
- !ruby/object:Gem::Version
|
363
|
+
version: '0'
|
364
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
365
|
+
none: false
|
366
|
+
requirements:
|
367
|
+
- - ! '>='
|
368
|
+
- !ruby/object:Gem::Version
|
369
|
+
version: '0'
|
389
370
|
requirements: []
|
390
|
-
|
391
371
|
rubyforge_project: tournament
|
392
|
-
rubygems_version: 1.
|
372
|
+
rubygems_version: 1.6.1
|
393
373
|
signing_key:
|
394
374
|
specification_version: 3
|
395
|
-
summary: Small library, command line program and Rails web GUI for managing a NCAA
|
396
|
-
|
375
|
+
summary: Small library, command line program and Rails web GUI for managing a NCAA
|
376
|
+
basketball tournament pool.
|
377
|
+
test_files:
|
397
378
|
- test/test_tournament.rb
|
398
379
|
- test/test_webgui_installer.rb
|
data/pool.dat
DELETED
Binary file
|