1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Merge pull request #1 from rjo1970/master

Some initial changes
This commit is contained in:
2015-05-17 10:09:14 -04:00
21 changed files with 91 additions and 54 deletions

26
Dockerfile Normal file
View File

@@ -0,0 +1,26 @@
FROM ruby:2.2.2
RUN apt-get update && apt-get upgrade -y && apt-get install -y build-essential
RUN apt-get install -y nodejs
ENV APP_HOME /wrestlingApp
ENV PORT 3000
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
ADD Gemfile* $APP_HOME/
RUN bundle install
ADD . $APP_HOME
RUN rake db:migrate RAILS_ENV=test
RUN rake db:migrate RAILS_ENV=development
RUN rake db:seed
RUN rake test
#CMD rails s puma --binding 0.0.0.0
CMD bundle exec passenger start -p $PORT --max-pool-size 3
EXPOSE 3000

View File

@@ -1,5 +1,5 @@
source 'https://rubygems.org' source 'https://rubygems.org'
ruby '2.2.0' ruby '2.2.2'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0' gem 'rails', '4.2.0'
@@ -55,7 +55,3 @@ gem 'spring', group: :development
group :development do group :development do
gem 'puma' gem 'puma'
end end

View File

@@ -8,7 +8,7 @@ Heroku production:
Development details: Development details:
* Ruby 2.2.0 * Ruby 2.2.2
* Rails 4.2.0 * Rails 4.2.0
@@ -20,6 +20,16 @@ Development details:
* Development login email: <tt>test@test.com</tt> password: <tt>password</tt> * Development login email: <tt>test@test.com</tt> password: <tt>password</tt>
Docker instructions:
* Building the image
```
docker build -t wrestling .
```
* Running the image (as development)
```
docker run -it --rm -p 3000:3000 wrestling
```
What the app does now: What the app does now:

View File

@@ -8,7 +8,7 @@ class Boutgen
@matches = matches.sort_by{|x|[x.weight_max]} @matches = matches.sort_by{|x|[x.weight_max]}
@matches.each_with_index do |m, i| @matches.each_with_index do |m, i|
@bout = m.round * 1000 + i @bout = m.round * 1000 + i
m.boutNumber = @bout m.bout_number = @bout
end end
return @matches return @matches
end end

View File

@@ -17,8 +17,8 @@ class Losernamegen
@match1 = matches.select{|m| m.loser1_name == "Winner Pool 1"}.first @match1 = matches.select{|m| m.loser1_name == "Winner Pool 1"}.first
@match2 = matches.select{|m| m.loser1_name == "Winner Pool 2"}.first @match2 = matches.select{|m| m.loser1_name == "Winner Pool 2"}.first
@matchChange = matches.select{|m| m.bracket_position == "3/4"}.first @matchChange = matches.select{|m| m.bracket_position == "3/4"}.first
@matchChange.loser1_name = "Loser of #{@match1.boutNumber}" @matchChange.loser1_name = "Loser of #{@match1.bout_number}"
@matchChange.loser2_name = "Loser of #{@match2.boutNumber}" @matchChange.loser2_name = "Loser of #{@match2.bout_number}"
end end
def fourPoolsToQuarterLoser(matches) def fourPoolsToQuarterLoser(matches)
@@ -29,18 +29,18 @@ class Losernamegen
@seventhEighth = matches.select{|m| m.bracket_position == "7/8"}.first @seventhEighth = matches.select{|m| m.bracket_position == "7/8"}.first
@consoSemis.each do |match| @consoSemis.each do |match|
if match.bracket_position_number == 1 if match.bracket_position_number == 1
match.loser1_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 1}.first.boutNumber}" match.loser1_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 1}.first.bout_number}"
match.loser2_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 2}.first.boutNumber}" match.loser2_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 2}.first.bout_number}"
elsif match.bracket_position_number == 2 elsif match.bracket_position_number == 2
match.loser1_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 3}.first.boutNumber}" match.loser1_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 3}.first.bout_number}"
match.loser2_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 4}.first.boutNumber}" match.loser2_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 4}.first.bout_number}"
end end
end end
@thirdFourth.loser1_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 1}.first.boutNumber}" @thirdFourth.loser1_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 1}.first.bout_number}"
@thirdFourth.loser2_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 2}.first.boutNumber}" @thirdFourth.loser2_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 2}.first.bout_number}"
@consoSemis = matches.select{|m| m.bracket_position == "Conso Semis"} @consoSemis = matches.select{|m| m.bracket_position == "Conso Semis"}
@seventhEighth.loser1_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 1}.first.boutNumber}" @seventhEighth.loser1_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 1}.first.bout_number}"
@seventhEighth.loser2_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 2}.first.boutNumber}" @seventhEighth.loser2_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 2}.first.bout_number}"
end end
def fourPoolsToSemiLoser(matches) def fourPoolsToSemiLoser(matches)
@@ -48,9 +48,9 @@ class Losernamegen
@thirdFourth = matches.select{|m| m.bracket_position == "3/4"}.first @thirdFourth = matches.select{|m| m.bracket_position == "3/4"}.first
@consoSemis = matches.select{|m| m.bracket_position == "Conso Semis"} @consoSemis = matches.select{|m| m.bracket_position == "Conso Semis"}
@seventhEighth = matches.select{|m| m.bracket_position == "7/8"}.first @seventhEighth = matches.select{|m| m.bracket_position == "7/8"}.first
@thirdFourth.loser1_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 1}.first.boutNumber}" @thirdFourth.loser1_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 1}.first.bout_number}"
@thirdFourth.loser2_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 2}.first.boutNumber}" @thirdFourth.loser2_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 2}.first.bout_number}"
@seventhEighth.loser1_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 1}.first.boutNumber}" @seventhEighth.loser1_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 1}.first.bout_number}"
@seventhEighth.loser2_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 2}.first.boutNumber}" @seventhEighth.loser2_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 2}.first.bout_number}"
end end
end end

View File

@@ -27,7 +27,7 @@ class Wrestler < ActiveRecord::Base
if @match.blank? if @match.blank?
return "BYE" return "BYE"
else else
return @match.boutNumber return @match.bout_number
end end
end end

View File

@@ -66,7 +66,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -78,7 +78,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -90,7 +90,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -115,7 +115,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -140,7 +140,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -152,7 +152,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -177,7 +177,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>

View File

@@ -66,7 +66,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -78,7 +78,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -104,7 +104,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -131,7 +131,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -143,7 +143,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -168,7 +168,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>

View File

@@ -66,7 +66,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -90,7 +90,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>

View File

@@ -66,7 +66,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -78,7 +78,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
@@ -104,7 +104,7 @@ li.game{
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li> <li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
<li class="game game-spacer"><%= match.boutNumber %> &nbsp;</li> <li class="game game-spacer"><%= match.bout_number %> &nbsp;</li>
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li> <li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
<li class="spacer">&nbsp;</li> <li class="spacer">&nbsp;</li>

View File

@@ -23,7 +23,7 @@
<% @matches.each.map do |m| %> <% @matches.each.map do |m| %>
<tr> <tr>
<td>Round <%= m.round %></td> <td>Round <%= m.round %></td>
<td><%= m.boutNumber %></td> <td><%= m.bout_number %></td>
<td><%= m.weight_max %> lbs</td> <td><%= m.weight_max %> lbs</td>
<td><%= m.w1_name %> vs. <%= m.w2_name %></td> <td><%= m.w1_name %> vs. <%= m.w2_name %></td>
</tr> </tr>

View File

@@ -4,7 +4,7 @@ class CreateSchools < ActiveRecord::Migration
t.string :name t.string :name
t.integer :score t.integer :score
t.timestamps t.timestamps null: true
end end
end end
end end

View File

@@ -3,7 +3,7 @@ class CreateWeights < ActiveRecord::Migration
create_table :weights do |t| create_table :weights do |t|
t.integer :max t.integer :max
t.timestamps t.timestamps null: true
end end
end end
end end

View File

@@ -7,7 +7,7 @@ class CreateWrestlers < ActiveRecord::Migration
t.integer :seed t.integer :seed
t.integer :original_seed t.integer :original_seed
t.timestamps t.timestamps null: true
end end
end end
end end

View File

@@ -6,7 +6,7 @@ class CreateTournaments < ActiveRecord::Migration
t.string :director t.string :director
t.string :director_email t.string :director_email
t.timestamps t.timestamps null: true
end end
end end
end end

View File

@@ -31,7 +31,7 @@ class DeviseCreateUsers < ActiveRecord::Migration
# t.datetime :locked_at # t.datetime :locked_at
t.timestamps t.timestamps null: true
end end
add_index :users, :email, :unique => true add_index :users, :email, :unique => true

View File

@@ -9,7 +9,7 @@ class CreateMatches < ActiveRecord::Migration
t.string :win_type t.string :win_type
t.string :score t.string :score
t.timestamps t.timestamps null: true
end end
end end
end end

View File

@@ -4,7 +4,7 @@ class CreateMats < ActiveRecord::Migration
t.string :name t.string :name
t.integer :tournament_id t.integer :tournament_id
t.timestamps t.timestamps null: true
end end
end end
end end

View File

@@ -0,0 +1,5 @@
class RenameBoutNumber < ActiveRecord::Migration
def change
rename_column :matches, :boutNumber, :bout_number
end
end

View File

@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150427163818) do ActiveRecord::Schema.define(version: 20150517075923) do
create_table "matches", force: :cascade do |t| create_table "matches", force: :cascade do |t|
t.integer "w1" t.integer "w1"
@@ -26,7 +26,7 @@ ActiveRecord::Schema.define(version: 20150427163818) do
t.integer "tournament_id" t.integer "tournament_id"
t.integer "round" t.integer "round"
t.integer "finished" t.integer "finished"
t.integer "boutNumber" t.integer "bout_number"
t.integer "weight_id" t.integer "weight_id"
t.string "bracket_position" t.string "bracket_position"
t.integer "bracket_position_number" t.integer "bracket_position_number"

View File

@@ -70,14 +70,14 @@ class PoolbracketMatchupsTest < ActionDispatch::IntegrationTest
refute_nil @tournament refute_nil @tournament
end end
test "tests boutNumber matches round" do test "tests bout_number matches round" do
@matchup_to_test = @genMatchups.select{|m| m.boutNumber == 4000}.first @matchup_to_test = @genMatchups.select{|m| m.bout_number == 4000}.first
assert_equal 4, @matchup_to_test.round assert_equal 4, @matchup_to_test.round
end end
test "tests boutNumbers are generated with smallest weight first regardless of id" do test "tests bout_numbers are generated with smallest weight first regardless of id" do
@weight = @tournament.weights.map.sort_by{|x|[x.max]}.first @weight = @tournament.weights.map.sort_by{|x|[x.max]}.first
@matchup = @genMatchups.select{|m| m.boutNumber == 1000}.first @matchup = @genMatchups.select{|m| m.bout_number == 1000}.first
assert_equal @weight.max, @matchup.weight_max assert_equal @weight.max, @matchup.weight_max
end end