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 +3 -0
- data/lib/tournament.rb +1 -1
- data/pool.dat +0 -0
- data/webgui/app/controllers/admin_controller.rb +12 -4
- data/webgui/app/controllers/reports_controller.rb +1 -0
- data/webgui/app/views/reports/show.html.erb +1 -1
- data/webgui/app/views/shared/_admins.html.erb +1 -1
- data/webgui/app/views/shared/_bracket.html.erb +2 -1
- data/webgui/lib/prince.rb +1 -0
- data/webgui/test/fixtures/entries.yml +9 -0
- data/webgui/test/fixtures/pools.yml +1 -0
- data/webgui/test/functional/entry_controller_test.rb +30 -1
- metadata +4 -3
    
        data/History.txt
    CHANGED
    
    
    
        data/lib/tournament.rb
    CHANGED
    
    
    
        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. | 
| 6 | 
            +
                @entry = Entry.find(params[:id])
         | 
| 7 7 | 
             
                if @entry
         | 
| 8 8 | 
             
                  @pool = @entry.pool
         | 
| 9 | 
            -
                   | 
| 10 | 
            -
             | 
| 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."
         | 
| @@ -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 @ | 
| 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"> </TD>
         | 
| 97 97 | 
             
            <!-- SEED 1 TOP  1/33 -->
         | 
| 98 | 
            +
            </TR>
         | 
| 98 99 | 
             
            <TR>
         | 
| 99 100 | 
             
            <TD class="space"> </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"> </TD>
         | 
| 104 105 | 
             
            <TD class="space"> </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
         | 
| @@ -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 | 
            -
              -  | 
| 9 | 
            -
              version: 3.3. | 
| 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 | 
            +
            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
         |