tournament 3.3.3 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ == 4.0.0 / 2011-03-14
2
+ * 2011 bracket.
3
+ * Upgrade to Rails 2.3.11.
4
+
1
5
  == 3.3.3 / 2010-03-21
2
6
  * Show link to possibility report if stats file exists.
3
7
 
@@ -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.5)
316
+ * rails (2.3.11)
316
317
  * rake (0.8.7)
317
- * sqlite3-ruby (1.2.5)
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) 2008
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
@@ -13,7 +13,7 @@ task :default => 'test:run'
13
13
  Bones {
14
14
  depend_on 'main'
15
15
  depend_on 'rake'
16
- depend_on 'rails'
16
+ depend_on 'rails', :version => "2.3.11"
17
17
 
18
18
  name 'tournament'
19
19
  authors 'Douglas A. Seifert'
@@ -7,7 +7,7 @@ unless defined? Tournament
7
7
  module Tournament
8
8
 
9
9
  # :stopdoc:
10
- VERSION = '3.3.3'
10
+ VERSION = '4.0.0'
11
11
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
12
12
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
13
13
  # :startdoc:
@@ -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
- next if region_name.blank? || region_hash[:seedings].blank?
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.find_or_create_by_region_and_seed(region.name, seeding_hash[:seed])
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
@@ -1,7 +1,7 @@
1
1
  class Entry < ActiveRecord::Base
2
2
  belongs_to :user
3
3
  belongs_to :pool
4
- validates_uniqueness_of :name
4
+ validates_uniqueness_of :name, :scope => :pool_id
5
5
  validates_presence_of :tie_break
6
6
  validates_presence_of :user_id
7
7
  attr_accessor :old_name
@@ -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,6 +5,7 @@
5
5
  <%= javascript_include_tag 'bracket' %>
6
6
  <%= stylesheet_link_tag 'main' %>
7
7
  <%= stylesheet_link_tag 'bracket' %>
8
+ <%= csrf_meta_tag %>
8
9
  </head>
9
10
  <body>
10
11
  <div id="wrap">
@@ -2,6 +2,7 @@
2
2
  <head>
3
3
  <title><%=TOURNAMENT_TITLE%></title>
4
4
  <%= stylesheet_link_tag 'main' %>
5
+ <%= csrf_meta_tag %>
5
6
  </head>
6
7
  <body>
7
8
  <div id="wrap">
@@ -5,6 +5,7 @@
5
5
  <%= javascript_include_tag 'bracket' %>
6
6
  <%= stylesheet_link_tag 'main' %>
7
7
  <%= stylesheet_link_tag 'bracket' %>
8
+ <%= csrf_meta_tag %>
8
9
  </head>
9
10
  <body>
10
11
  <%= yield %>
@@ -3,6 +3,7 @@
3
3
  <title><%=TOURNAMENT_TITLE%></title>
4
4
  <%= stylesheet_link_tag 'main' %>
5
5
  <%= stylesheet_link_tag 'reports' %>
6
+ <%= csrf_meta_tag %>
6
7
  </head>
7
8
  <body>
8
9
  <div id="wrap">
@@ -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.5' unless defined? RAILS_GEM_VERSION
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.
@@ -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 = true if bracket.complete?
21
+ entry.completed = bracket.complete?
22
22
  end
23
23
  end
@@ -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/2010FinalFour.jpg) center no-repeat;
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
- prerelease: false
5
- segments:
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
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
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
- requirement: &id002 !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
- - 8
44
- - 7
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
- requirement: &id003 !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- segments:
56
- - 2
57
- - 3
58
- - 5
59
- version: 2.3.5
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
- requirement: &id004 !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- segments:
70
- - 3
71
- - 3
72
- - 0
73
- version: 3.3.0
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
- version_requirements: *id004
76
- description: |-
77
- Small library, command line program and Rails web GUI for managing a NCAA
78
- basketball tournament pool.
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
- requirements:
377
- - - ">="
378
- - !ruby/object:Gem::Version
379
- segments:
380
- - 0
381
- version: "0"
382
- required_rubygems_version: !ruby/object:Gem::Requirement
383
- requirements:
384
- - - ">="
385
- - !ruby/object:Gem::Version
386
- segments:
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.3.6
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 basketball tournament pool
396
- test_files:
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