mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
26
Dockerfile
Normal file
26
Dockerfile
Normal 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
|
||||
6
Gemfile
6
Gemfile
@@ -1,5 +1,5 @@
|
||||
source 'https://rubygems.org'
|
||||
ruby '2.2.0'
|
||||
ruby '2.2.2'
|
||||
|
||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||
gem 'rails', '4.2.0'
|
||||
@@ -55,7 +55,3 @@ gem 'spring', group: :development
|
||||
group :development do
|
||||
gem 'puma'
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
12
README.rdoc
12
README.rdoc
@@ -8,7 +8,7 @@ Heroku production:
|
||||
|
||||
Development details:
|
||||
|
||||
* Ruby 2.2.0
|
||||
* Ruby 2.2.2
|
||||
|
||||
* Rails 4.2.0
|
||||
|
||||
@@ -20,6 +20,16 @@ Development details:
|
||||
|
||||
* 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:
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ class Boutgen
|
||||
@matches = matches.sort_by{|x|[x.weight_max]}
|
||||
@matches.each_with_index do |m, i|
|
||||
@bout = m.round * 1000 + i
|
||||
m.boutNumber = @bout
|
||||
m.bout_number = @bout
|
||||
end
|
||||
return @matches
|
||||
end
|
||||
|
||||
@@ -17,8 +17,8 @@ class Losernamegen
|
||||
@match1 = matches.select{|m| m.loser1_name == "Winner Pool 1"}.first
|
||||
@match2 = matches.select{|m| m.loser1_name == "Winner Pool 2"}.first
|
||||
@matchChange = matches.select{|m| m.bracket_position == "3/4"}.first
|
||||
@matchChange.loser1_name = "Loser of #{@match1.boutNumber}"
|
||||
@matchChange.loser2_name = "Loser of #{@match2.boutNumber}"
|
||||
@matchChange.loser1_name = "Loser of #{@match1.bout_number}"
|
||||
@matchChange.loser2_name = "Loser of #{@match2.bout_number}"
|
||||
end
|
||||
|
||||
def fourPoolsToQuarterLoser(matches)
|
||||
@@ -29,18 +29,18 @@ class Losernamegen
|
||||
@seventhEighth = matches.select{|m| m.bracket_position == "7/8"}.first
|
||||
@consoSemis.each do |match|
|
||||
if match.bracket_position_number == 1
|
||||
match.loser1_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 1}.first.boutNumber}"
|
||||
match.loser2_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 2}.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.bout_number}"
|
||||
elsif match.bracket_position_number == 2
|
||||
match.loser1_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 3}.first.boutNumber}"
|
||||
match.loser2_name = "Loser of #{@quarters.select{|m| m.bracket_position_number == 4}.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.bout_number}"
|
||||
end
|
||||
end
|
||||
@thirdFourth.loser1_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 1}.first.boutNumber}"
|
||||
@thirdFourth.loser2_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 2}.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.bout_number}"
|
||||
@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.loser2_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 2}.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.bout_number}"
|
||||
end
|
||||
|
||||
def fourPoolsToSemiLoser(matches)
|
||||
@@ -48,9 +48,9 @@ class Losernamegen
|
||||
@thirdFourth = matches.select{|m| m.bracket_position == "3/4"}.first
|
||||
@consoSemis = matches.select{|m| m.bracket_position == "Conso Semis"}
|
||||
@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.loser2_name = "Loser of #{@semis.select{|m| m.bracket_position_number == 2}.first.boutNumber}"
|
||||
@seventhEighth.loser1_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 1}.first.boutNumber}"
|
||||
@seventhEighth.loser2_name = "Loser of #{@consoSemis.select{|m| m.bracket_position_number == 2}.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.bout_number}"
|
||||
@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.bout_number}"
|
||||
end
|
||||
end
|
||||
@@ -27,7 +27,7 @@ class Wrestler < ActiveRecord::Base
|
||||
if @match.blank?
|
||||
return "BYE"
|
||||
else
|
||||
return @match.boutNumber
|
||||
return @match.bout_number
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -78,7 +78,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -90,7 +90,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -115,7 +115,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -140,7 +140,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -152,7 +152,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -177,7 +177,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
|
||||
@@ -66,7 +66,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -78,7 +78,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -104,7 +104,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -131,7 +131,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -143,7 +143,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -168,7 +168,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
|
||||
@@ -66,7 +66,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -90,7 +90,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
|
||||
@@ -66,7 +66,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -78,7 +78,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
@@ -104,7 +104,7 @@ li.game{
|
||||
<li class="spacer"> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_name %> <span>Score</span></li>
|
||||
<li class="game game-spacer"><%= match.boutNumber %> </li>
|
||||
<li class="game game-spacer"><%= match.bout_number %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_name %><span>Score</span></li>
|
||||
|
||||
<li class="spacer"> </li>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<% @matches.each.map do |m| %>
|
||||
<tr>
|
||||
<td>Round <%= m.round %></td>
|
||||
<td><%= m.boutNumber %></td>
|
||||
<td><%= m.bout_number %></td>
|
||||
<td><%= m.weight_max %> lbs</td>
|
||||
<td><%= m.w1_name %> vs. <%= m.w2_name %></td>
|
||||
</tr>
|
||||
|
||||
@@ -4,7 +4,7 @@ class CreateSchools < ActiveRecord::Migration
|
||||
t.string :name
|
||||
t.integer :score
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ class CreateWeights < ActiveRecord::Migration
|
||||
create_table :weights do |t|
|
||||
t.integer :max
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ class CreateWrestlers < ActiveRecord::Migration
|
||||
t.integer :seed
|
||||
t.integer :original_seed
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class CreateTournaments < ActiveRecord::Migration
|
||||
t.string :director
|
||||
t.string :director_email
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,7 +31,7 @@ class DeviseCreateUsers < ActiveRecord::Migration
|
||||
# t.datetime :locked_at
|
||||
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
|
||||
add_index :users, :email, :unique => true
|
||||
|
||||
@@ -9,7 +9,7 @@ class CreateMatches < ActiveRecord::Migration
|
||||
t.string :win_type
|
||||
t.string :score
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ class CreateMats < ActiveRecord::Migration
|
||||
t.string :name
|
||||
t.integer :tournament_id
|
||||
|
||||
t.timestamps
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
5
db/migrate/20150517075923_rename_bout_number.rb
Normal file
5
db/migrate/20150517075923_rename_bout_number.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class RenameBoutNumber < ActiveRecord::Migration
|
||||
def change
|
||||
rename_column :matches, :boutNumber, :bout_number
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# 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|
|
||||
t.integer "w1"
|
||||
@@ -26,7 +26,7 @@ ActiveRecord::Schema.define(version: 20150427163818) do
|
||||
t.integer "tournament_id"
|
||||
t.integer "round"
|
||||
t.integer "finished"
|
||||
t.integer "boutNumber"
|
||||
t.integer "bout_number"
|
||||
t.integer "weight_id"
|
||||
t.string "bracket_position"
|
||||
t.integer "bracket_position_number"
|
||||
|
||||
@@ -70,14 +70,14 @@ class PoolbracketMatchupsTest < ActionDispatch::IntegrationTest
|
||||
refute_nil @tournament
|
||||
end
|
||||
|
||||
test "tests boutNumber matches round" do
|
||||
@matchup_to_test = @genMatchups.select{|m| m.boutNumber == 4000}.first
|
||||
test "tests bout_number matches round" do
|
||||
@matchup_to_test = @genMatchups.select{|m| m.bout_number == 4000}.first
|
||||
assert_equal 4, @matchup_to_test.round
|
||||
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
|
||||
@matchup = @genMatchups.select{|m| m.boutNumber == 1000}.first
|
||||
@matchup = @genMatchups.select{|m| m.bout_number == 1000}.first
|
||||
assert_equal @weight.max, @matchup.weight_max
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user