mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Compare commits
21 Commits
circleci-p
...
537eccf04d
| Author | SHA1 | Date | |
|---|---|---|---|
| 537eccf04d | |||
| 89a695388a | |||
| 0aea26967a | |||
| 5677f4e944 | |||
| f5ddc6652d | |||
| 987c89b7d5 | |||
| b2ba1901df | |||
| 6c86f25add | |||
| ce063f5faa | |||
| 396e4be5b3 | |||
| 46919a2b1b | |||
| 55d122771c | |||
| e43f3253d4 | |||
| f720de0db6 | |||
| 44c9f947d7 | |||
| ee8d861bee | |||
| bdd80fc1d2 | |||
| db15e79c0f | |||
| 1f5aa304ff | |||
| 4522113396 | |||
| 7327902fe8 |
@@ -1,10 +1,39 @@
|
||||
version: 2
|
||||
workflows: # Define a Workflow running the build job, then the deploy job
|
||||
version: 2
|
||||
build-deploy:
|
||||
jobs:
|
||||
- build
|
||||
- deploy:
|
||||
requires:
|
||||
- build
|
||||
filters:
|
||||
branches:
|
||||
only: master # Only deploys when the commit is on the Master branch
|
||||
jobs:
|
||||
build:
|
||||
machine: true
|
||||
steps:
|
||||
- checkout
|
||||
# start proprietary DB using private Docker image
|
||||
# with credentials stored in the UI
|
||||
- run: |
|
||||
bash bin/run-tests-with-docker.sh
|
||||
bash bin/run-tests-with-docker.sh
|
||||
|
||||
# https://github.com/circleci/circleci-docs/blob/master/jekyll/_cci1/continuous-deployment-with-heroku.md
|
||||
deploy:
|
||||
machine: true
|
||||
steps:
|
||||
- checkout
|
||||
- run: |
|
||||
cat >~/.netrc <<EOF
|
||||
machine api.heroku.com
|
||||
login $HEROKU_EMAIL
|
||||
password $HEROKU_TOKEN
|
||||
machine git.heroku.com
|
||||
login $HEROKU_EMAIL
|
||||
password $HEROKU_TOKEN
|
||||
EOF
|
||||
chmod 600 ~/.netrc # Heroku cli complains about permissions without this
|
||||
heroku git:remote -a wrestlingapp
|
||||
git push heroku master
|
||||
sleep 20s
|
||||
heroku run rake db:migrate --app wrestlingapp
|
||||
21
.travis.yml
21
.travis.yml
@@ -1,21 +0,0 @@
|
||||
sudo: required
|
||||
language: minimal
|
||||
services:
|
||||
- docker
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- docker-ce
|
||||
env:
|
||||
- DOCKER_COMPOSE_VERSION=1.22.0
|
||||
script:
|
||||
- bash bin/run-tests-with-docker.sh
|
||||
deploy:
|
||||
provider: heroku
|
||||
api_key:
|
||||
secure: WQnMF1v9J8n3z+Icx1Sp2tcu5bsIDwuCRgmGSEyFEl0aI3KsFxCpNWKEhHougkBxYRi7XXW1TZGGwRYb5VNf5UVG4xqlgJE7vm4ri3PjU2x/bLJb6tJq+WNrXoJNzfeyRqwXpfOYJT6n3/ak7lsZrVY2zSIuNTdQQ1oVWk33x9KNyr1RS/XmygJDnsG8n7dnz4xUi57F2w3hORVF3Lm3a63F9hoBcZjZUeMHzLPPhG4yySkpBe1oWtFk58ZSyqCSpcpbiQSSCxHiMrlSJ6GDZjUFDe+GIkx/P8by+MP0qcS2dw1w5yPZvsAATe826xP+LmcZX7g2LHJbIDu+ZwisQDbWfhpShvIkgtnhG95fAF7pv+md6VsLf3cTggtOYKHXDGBTO2nHDDuol/W7ZZHiVT5Da52MFdkJ/4TTgzqWmnlDmmJT6nAZKgGp/dcnslUHscwM1nnhJZZqbxbg8tIZ3Q9+hLjh9vikO76ujkIaseJ+fGcpzTl5SvwW7NfINzJPkVZsPQb6tYNs01iKVfLJ8xNKvUswKe3G3nvrbfJahgySZ0+4xDEjQbbaa63RjyOw06DAcN3SgMj0o1w66NGdd1GzloggN0mdUfXkn+mjP3okYh7zgPY1n+ZJ88BQYJoScS790g30pqxR1Tj0uR3+TEd3Qmp7McfXKlMJiMXX2mI=
|
||||
app: wrestlingapp
|
||||
on:
|
||||
repo: jcwimer/wrestlingApp
|
||||
branch: master
|
||||
run: rake db:migrate RAILS_ENV=production
|
||||
4
Gemfile
4
Gemfile
@@ -1,8 +1,8 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
ruby '2.6.5'
|
||||
ruby '3.0.0'
|
||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||
gem 'rails', '6.0.3.2'
|
||||
gem 'rails', '6.1.2'
|
||||
# Use sqlite3 as the database for Active Record
|
||||
#gem 'sqlite3', '~> 1.3', '< 1.4', :group => :development
|
||||
gem 'sqlite3', :group => :development
|
||||
|
||||
231
Gemfile.lock
231
Gemfile.lock
@@ -1,71 +1,75 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (6.0.3.2)
|
||||
actionpack (= 6.0.3.2)
|
||||
actioncable (6.1.2)
|
||||
actionpack (= 6.1.2)
|
||||
activesupport (= 6.1.2)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailbox (6.0.3.2)
|
||||
actionpack (= 6.0.3.2)
|
||||
activejob (= 6.0.3.2)
|
||||
activerecord (= 6.0.3.2)
|
||||
activestorage (= 6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
actionmailbox (6.1.2)
|
||||
actionpack (= 6.1.2)
|
||||
activejob (= 6.1.2)
|
||||
activerecord (= 6.1.2)
|
||||
activestorage (= 6.1.2)
|
||||
activesupport (= 6.1.2)
|
||||
mail (>= 2.7.1)
|
||||
actionmailer (6.0.3.2)
|
||||
actionpack (= 6.0.3.2)
|
||||
actionview (= 6.0.3.2)
|
||||
activejob (= 6.0.3.2)
|
||||
actionmailer (6.1.2)
|
||||
actionpack (= 6.1.2)
|
||||
actionview (= 6.1.2)
|
||||
activejob (= 6.1.2)
|
||||
activesupport (= 6.1.2)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (6.0.3.2)
|
||||
actionview (= 6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
rack (~> 2.0, >= 2.0.8)
|
||||
actionpack (6.1.2)
|
||||
actionview (= 6.1.2)
|
||||
activesupport (= 6.1.2)
|
||||
rack (~> 2.0, >= 2.0.9)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actiontext (6.0.3.2)
|
||||
actionpack (= 6.0.3.2)
|
||||
activerecord (= 6.0.3.2)
|
||||
activestorage (= 6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
actiontext (6.1.2)
|
||||
actionpack (= 6.1.2)
|
||||
activerecord (= 6.1.2)
|
||||
activestorage (= 6.1.2)
|
||||
activesupport (= 6.1.2)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
actionview (6.1.2)
|
||||
activesupport (= 6.1.2)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||
activejob (6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
activejob (6.1.2)
|
||||
activesupport (= 6.1.2)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
activerecord (6.0.3.2)
|
||||
activemodel (= 6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
activestorage (6.0.3.2)
|
||||
actionpack (= 6.0.3.2)
|
||||
activejob (= 6.0.3.2)
|
||||
activerecord (= 6.0.3.2)
|
||||
activemodel (6.1.2)
|
||||
activesupport (= 6.1.2)
|
||||
activerecord (6.1.2)
|
||||
activemodel (= 6.1.2)
|
||||
activesupport (= 6.1.2)
|
||||
activestorage (6.1.2)
|
||||
actionpack (= 6.1.2)
|
||||
activejob (= 6.1.2)
|
||||
activerecord (= 6.1.2)
|
||||
activesupport (= 6.1.2)
|
||||
marcel (~> 0.3.1)
|
||||
activesupport (6.0.3.2)
|
||||
mimemagic (~> 0.3.2)
|
||||
activesupport (6.1.2)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
zeitwerk (~> 2.2, >= 2.2.2)
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
tzinfo (~> 2.0)
|
||||
zeitwerk (~> 2.3)
|
||||
addressable (2.4.0)
|
||||
ast (2.4.1)
|
||||
backports (3.18.2)
|
||||
ast (2.4.2)
|
||||
backports (3.20.2)
|
||||
bcrypt (3.1.16)
|
||||
brakeman (4.9.1)
|
||||
brakeman (5.0.0)
|
||||
builder (3.2.4)
|
||||
bullet (6.1.0)
|
||||
bullet (6.1.3)
|
||||
activesupport (>= 3.0.0)
|
||||
uniform_notifier (~> 1.11)
|
||||
cancancan (3.1.0)
|
||||
cancancan (3.2.1)
|
||||
coffee-rails (5.0.0)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (>= 5.2.0)
|
||||
@@ -75,21 +79,21 @@ GEM
|
||||
coffee-script-source (1.12.2)
|
||||
commander (4.4.6)
|
||||
highline (~> 1.7.2)
|
||||
concurrent-ruby (1.1.7)
|
||||
concurrent-ruby (1.1.8)
|
||||
crass (1.0.6)
|
||||
daemons (1.3.1)
|
||||
dalli (2.7.10)
|
||||
delayed_job (4.1.8)
|
||||
activesupport (>= 3.0, < 6.1)
|
||||
delayed_job_active_record (4.1.4)
|
||||
activerecord (>= 3.0, < 6.1)
|
||||
dalli (2.7.11)
|
||||
delayed_job (4.1.9)
|
||||
activesupport (>= 3.0, < 6.2)
|
||||
delayed_job_active_record (4.1.5)
|
||||
activerecord (>= 3.0, < 6.2)
|
||||
delayed_job (>= 3.0, < 5)
|
||||
delayed_job_web (1.4.3)
|
||||
activerecord (> 3.0.0)
|
||||
delayed_job (> 2.0.3)
|
||||
rack-protection (>= 1.5.5)
|
||||
sinatra (>= 1.4.4)
|
||||
devise (4.7.2)
|
||||
devise (4.7.3)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0)
|
||||
@@ -97,15 +101,15 @@ GEM
|
||||
warden (~> 1.2.3)
|
||||
domain_name (0.5.20190701)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
erubi (1.9.0)
|
||||
erubi (1.10.0)
|
||||
ethon (0.12.0)
|
||||
ffi (>= 1.3.0)
|
||||
execjs (2.7.0)
|
||||
faraday (0.17.3)
|
||||
faraday (0.17.4)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
faraday_middleware (0.14.0)
|
||||
faraday (>= 0.7.4, < 1.0)
|
||||
ffi (1.13.1)
|
||||
ffi (1.14.2)
|
||||
gh (0.15.1)
|
||||
addressable (~> 2.4.0)
|
||||
backports
|
||||
@@ -128,19 +132,19 @@ GEM
|
||||
http-accept (1.7.0)
|
||||
http-cookie (1.0.3)
|
||||
domain_name (~> 0.5)
|
||||
i18n (1.8.5)
|
||||
i18n (1.8.8)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jbuilder (2.10.1)
|
||||
jbuilder (2.11.2)
|
||||
activesupport (>= 5.0.0)
|
||||
jquery-rails (4.4.0)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (2.3.1)
|
||||
json (2.5.1)
|
||||
launchy (2.4.3)
|
||||
addressable (~> 2.3)
|
||||
libv8 (3.16.14.19)
|
||||
loofah (2.7.0)
|
||||
loofah (2.9.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
@@ -150,11 +154,11 @@ GEM
|
||||
method_source (1.0.0)
|
||||
mime-types (3.3.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2020.0512)
|
||||
mime-types-data (3.2020.1104)
|
||||
mimemagic (0.3.5)
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.14.2)
|
||||
mini_portile2 (2.5.0)
|
||||
minitest (5.14.3)
|
||||
multi_json (1.15.0)
|
||||
multipart-post (2.1.1)
|
||||
mustermann (1.1.1)
|
||||
@@ -163,41 +167,43 @@ GEM
|
||||
net-http-persistent (2.9.4)
|
||||
net-http-pipeline (1.0.1)
|
||||
netrc (0.11.0)
|
||||
newrelic_rpm (6.12.0.367)
|
||||
nio4r (2.5.3)
|
||||
nokogiri (1.10.10)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
newrelic_rpm (6.15.0)
|
||||
nio4r (2.5.5)
|
||||
nokogiri (1.11.1)
|
||||
mini_portile2 (~> 2.5.0)
|
||||
racc (~> 1.4)
|
||||
orm_adapter (0.5.0)
|
||||
parallel (1.19.2)
|
||||
parser (2.7.1.4)
|
||||
parallel (1.20.1)
|
||||
parser (3.0.0.0)
|
||||
ast (~> 2.4.1)
|
||||
passenger (6.0.6)
|
||||
passenger (6.0.7)
|
||||
rack
|
||||
rake (>= 0.8.1)
|
||||
puma (4.3.6)
|
||||
puma (5.2.1)
|
||||
nio4r (~> 2.0)
|
||||
pusher-client (0.6.2)
|
||||
json
|
||||
websocket (~> 1.0)
|
||||
racc (1.5.2)
|
||||
rack (2.2.3)
|
||||
rack-protection (2.1.0)
|
||||
rack
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (6.0.3.2)
|
||||
actioncable (= 6.0.3.2)
|
||||
actionmailbox (= 6.0.3.2)
|
||||
actionmailer (= 6.0.3.2)
|
||||
actionpack (= 6.0.3.2)
|
||||
actiontext (= 6.0.3.2)
|
||||
actionview (= 6.0.3.2)
|
||||
activejob (= 6.0.3.2)
|
||||
activemodel (= 6.0.3.2)
|
||||
activerecord (= 6.0.3.2)
|
||||
activestorage (= 6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 6.0.3.2)
|
||||
rails (6.1.2)
|
||||
actioncable (= 6.1.2)
|
||||
actionmailbox (= 6.1.2)
|
||||
actionmailer (= 6.1.2)
|
||||
actionpack (= 6.1.2)
|
||||
actiontext (= 6.1.2)
|
||||
actionview (= 6.1.2)
|
||||
activejob (= 6.1.2)
|
||||
activemodel (= 6.1.2)
|
||||
activerecord (= 6.1.2)
|
||||
activestorage (= 6.1.2)
|
||||
activesupport (= 6.1.2)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 6.1.2)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
@@ -209,18 +215,18 @@ GEM
|
||||
rails_stdout_logging
|
||||
rails_serve_static_assets (0.0.5)
|
||||
rails_stdout_logging (0.0.5)
|
||||
railties (6.0.3.2)
|
||||
actionpack (= 6.0.3.2)
|
||||
activesupport (= 6.0.3.2)
|
||||
railties (6.1.2)
|
||||
actionpack (= 6.1.2)
|
||||
activesupport (= 6.1.2)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.20.3, < 2.0)
|
||||
thor (~> 1.0)
|
||||
rainbow (3.0.0)
|
||||
rake (13.0.1)
|
||||
rake (13.0.3)
|
||||
rb-readline (0.5.5)
|
||||
rdoc (6.2.1)
|
||||
rdoc (6.3.0)
|
||||
ref (2.0.0)
|
||||
regexp_parser (1.7.1)
|
||||
regexp_parser (2.0.3)
|
||||
responders (3.0.1)
|
||||
actionpack (>= 5.0)
|
||||
railties (>= 5.0)
|
||||
@@ -230,21 +236,21 @@ GEM
|
||||
mime-types (>= 1.16, < 4.0)
|
||||
netrc (~> 0.8)
|
||||
rexml (3.2.4)
|
||||
round_robin_tournament (0.0.1)
|
||||
rubocop (0.91.0)
|
||||
round_robin_tournament (0.1.1)
|
||||
rubocop (1.9.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.7.1.1)
|
||||
parser (>= 3.0.0.0)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.7)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml
|
||||
rubocop-ast (>= 0.4.0, < 1.0)
|
||||
rubocop-ast (>= 1.2.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 2.0)
|
||||
rubocop-ast (0.4.0)
|
||||
parser (>= 2.7.1.4)
|
||||
ruby-progressbar (1.10.1)
|
||||
ruby2_keywords (0.0.2)
|
||||
sdoc (1.1.0)
|
||||
unicode-display_width (>= 1.4.0, < 3.0)
|
||||
rubocop-ast (1.4.1)
|
||||
parser (>= 2.7.1.5)
|
||||
ruby-progressbar (1.11.0)
|
||||
ruby2_keywords (0.0.4)
|
||||
sdoc (2.0.3)
|
||||
rdoc (>= 5.0)
|
||||
sinatra (2.1.0)
|
||||
mustermann (~> 1.0)
|
||||
@@ -260,13 +266,12 @@ GEM
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.4.2)
|
||||
terminal-table (1.8.0)
|
||||
terminal-table (3.0.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
therubyracer (0.12.3)
|
||||
libv8 (~> 3.16.14.15)
|
||||
ref
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
thor (1.1.0)
|
||||
tilt (2.0.10)
|
||||
travis (1.8.13)
|
||||
backports
|
||||
@@ -282,9 +287,9 @@ GEM
|
||||
turbolinks-source (5.2.0)
|
||||
typhoeus (0.8.0)
|
||||
ethon (>= 0.8.0)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
tzinfo-data (1.2020.1)
|
||||
tzinfo (2.0.4)
|
||||
concurrent-ruby (~> 1.0)
|
||||
tzinfo-data (1.2021.1)
|
||||
tzinfo (>= 1.0.0)
|
||||
uglifier (4.2.0)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
@@ -292,14 +297,14 @@ GEM
|
||||
unf_ext
|
||||
unf_ext (0.0.7.7)
|
||||
unicode-display_width (1.7.0)
|
||||
uniform_notifier (1.13.0)
|
||||
uniform_notifier (1.13.2)
|
||||
warden (1.2.9)
|
||||
rack (>= 2.0.9)
|
||||
websocket (1.2.8)
|
||||
websocket (1.2.9)
|
||||
websocket-driver (0.7.3)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
zeitwerk (2.4.0)
|
||||
zeitwerk (2.4.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
@@ -321,7 +326,7 @@ DEPENDENCIES
|
||||
newrelic_rpm
|
||||
passenger
|
||||
puma
|
||||
rails (= 6.0.3.2)
|
||||
rails (= 6.1.2)
|
||||
rails_12factor
|
||||
rb-readline
|
||||
round_robin_tournament
|
||||
@@ -336,7 +341,7 @@ DEPENDENCIES
|
||||
uglifier
|
||||
|
||||
RUBY VERSION
|
||||
ruby 2.6.5p114
|
||||
ruby 3.0.0p0
|
||||
|
||||
BUNDLED WITH
|
||||
2.0.2
|
||||
2.2.9
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
This application is being created to run a wrestling tournament.
|
||||
|
||||
### Current master status
|
||||
[](https://travis-ci.org/jcwimer/wrestlingApp)
|
||||
[](https://travis-ci.org/jcwimer/wrestlingApp)
|
||||
|
||||
### Current development status
|
||||
[](https://travis-ci.org/jcwimer/wrestlingApp)
|
||||
[](https://travis-ci.org/jcwimer/wrestlingApp)
|
||||
|
||||
# Info
|
||||
**License:** MIT License
|
||||
@@ -13,8 +13,8 @@ This application is being created to run a wrestling tournament.
|
||||
**Public Production Url:** [https://wrestlingdev.com](http://wrestlingdev.com)
|
||||
|
||||
**App Info**
|
||||
* Ruby 2.6.5
|
||||
* Rails 6.0.1
|
||||
* Ruby 3.0.0
|
||||
* Rails 6.1.2
|
||||
* DB mysql or mariadb
|
||||
* Memcached
|
||||
* Delayed Jobs
|
||||
|
||||
@@ -165,7 +165,7 @@ class TournamentsController < ApplicationController
|
||||
end
|
||||
|
||||
def create_custom_weights
|
||||
@custom = params[:customValue].to_s
|
||||
@custom = params[:customValue].split(",")
|
||||
@tournament.create_pre_defined_weights(@custom)
|
||||
redirect_to "/tournaments/#{@tournament.id}"
|
||||
end
|
||||
|
||||
@@ -96,7 +96,7 @@ class Match < ActiveRecord::Base
|
||||
elsif self.win_type == "DQ"
|
||||
return "(DQ)"
|
||||
elsif self.win_type == "Forfeit"
|
||||
return "(For)"
|
||||
return "(FF)"
|
||||
else
|
||||
win_type_abbreviation = "#{self.win_type.chars.to_a[0..2].join('')}"
|
||||
return "(#{win_type_abbreviation} #{self.score})"
|
||||
|
||||
@@ -14,10 +14,15 @@ class School < ActiveRecord::Base
|
||||
|
||||
def abbreviation
|
||||
name_array = self.name.split(' ')
|
||||
if name_array.size > 1
|
||||
return "#{name_array[0].chars.to_a.first}#{name_array[1].chars.to_a[0..1].join('').upcase}"
|
||||
if name_array.size > 2
|
||||
# If three words, use first letter of first word, first letter of second, and first two of third
|
||||
return "#{name_array[0].chars.to_a.first}#{name_array[1].chars.to_a.first}#{name_array[2].chars.to_a[0..1].join('').upcase}"
|
||||
elsif name_array.size > 1
|
||||
# If two words use first letter of first word and first three of the second
|
||||
return "#{name_array[0].chars.to_a.first}#{name_array[1].chars.to_a[0..2].join('').upcase}"
|
||||
else
|
||||
return "#{name_array[0].chars.to_a[0..2].join('').upcase}"
|
||||
# If one word use first four letters
|
||||
return "#{name_array[0].chars.to_a[0..3].join('').upcase}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -29,17 +29,21 @@ class Tournament < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def tournament_types
|
||||
["Pool to bracket","Modified 16 Man Double Elimination","Double Elimination 1-6"]
|
||||
["Pool to bracket","Modified 16 Man Double Elimination 1-6","Modified 16 Man Double Elimination 1-8","Regular Double Elimination 1-6"]
|
||||
end
|
||||
|
||||
def create_pre_defined_weights(value)
|
||||
|
||||
def number_of_placers
|
||||
if self.tournament_type.include? "1-8"
|
||||
return 8
|
||||
elsif self.tournament_type.include? "1-6"
|
||||
return 6
|
||||
end
|
||||
end
|
||||
|
||||
def create_pre_defined_weights(weight_classes)
|
||||
weights.destroy_all
|
||||
if value == 'hs'
|
||||
Weight::HS_WEIGHT_CLASSES.each do |w|
|
||||
weights.create(max: w)
|
||||
end
|
||||
else
|
||||
raise "Unspecified behavior"
|
||||
weight_classes.each do |w|
|
||||
weights.create(max: w)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -116,7 +120,7 @@ class Tournament < ActiveRecord::Base
|
||||
|
||||
def modified_sixteen_man_number_of_wrestlers
|
||||
error_string = ""
|
||||
if self.tournament_type == "Modified 16 Man Double Elimination"
|
||||
if self.tournament_type.include? "Modified 16 Man Double Elimination"
|
||||
weights_with_too_many_wrestlers = weights.select{|w| w.wrestlers.size > 16}
|
||||
weight_with_too_few_wrestlers = weights.select{|w| w.wrestlers.size < 12}
|
||||
weights_with_too_many_wrestlers.each do |weight|
|
||||
@@ -145,17 +149,17 @@ class Tournament < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def match_generation_error
|
||||
errorString = "There is a tournament error."
|
||||
error_string = "There is a tournament error."
|
||||
modified_sixteen_man_error = modified_sixteen_man_number_of_wrestlers
|
||||
double_elim_error = double_elim_number_of_wrestlers
|
||||
if pool_to_bracket_weights_with_too_many_wrestlers != nil
|
||||
errorString = errorString + " The following weights have too many wrestlers "
|
||||
error_string = error_string + " The following weights have too many wrestlers "
|
||||
pool_to_bracket_weights_with_too_many_wrestlers.each do |w|
|
||||
errorString = errorString + "#{w.max} "
|
||||
error_string = error_string + "#{w.max} "
|
||||
end
|
||||
return errorString
|
||||
return error_string
|
||||
elsif modified_sixteen_man_error.length > 0
|
||||
return errorString + modified_sixteen_man_error
|
||||
return error_string + modified_sixteen_man_error
|
||||
elsif double_elim_error.length > 0
|
||||
return error_string + double_elim_error
|
||||
else
|
||||
|
||||
@@ -7,7 +7,11 @@ class Weight < ActiveRecord::Base
|
||||
|
||||
validates :max, presence: true
|
||||
|
||||
HS_WEIGHT_CLASSES = [106,113,120,126,132,138,145,152,160,170,182,195,220,285]
|
||||
# passed via layouts/_tournament-navbar.html.erb
|
||||
# tournaments controller does a .split(',') on this string and creates an array via commas
|
||||
# tournament model runs the code via method create_pre_defined_weights
|
||||
HS_WEIGHT_CLASSES = "106,113,120,126,132,138,145,152,160,170,182,195,220,285"
|
||||
HS_GIRLS_WEIGHT_CLASSES = "101,106,111,116,121,126,131,137,143,150,160,170,189,235"
|
||||
|
||||
before_destroy do
|
||||
self.tournament.destroy_all_matches
|
||||
|
||||
@@ -15,8 +15,8 @@ class AdvanceWrestler
|
||||
|
||||
def advance_raw
|
||||
pool_to_bracket_advancement if @tournament.tournament_type == "Pool to bracket"
|
||||
DoubleEliminationAdvance.new(@wrestler, @last_match).bracket_advancement if @tournament.tournament_type == "Modified 16 Man Double Elimination" or
|
||||
@tournament.tournament_type == "Double Elimination 1-6"
|
||||
DoubleEliminationAdvance.new(@wrestler, @last_match).bracket_advancement if @tournament.tournament_type.include? "Modified 16 Man Double Elimination" or
|
||||
@tournament.tournament_type.include? "Regular Double Elimination"
|
||||
end
|
||||
|
||||
def pool_to_bracket_advancement
|
||||
|
||||
@@ -33,12 +33,12 @@ class GenerateTournamentMatches
|
||||
def generate_raw
|
||||
standardStartingActions
|
||||
PoolToBracketMatchGeneration.new(@tournament).generatePoolToBracketMatches if @tournament.tournament_type == "Pool to bracket"
|
||||
ModifiedSixteenManMatchGeneration.new(@tournament).generate_matches if @tournament.tournament_type == "Modified 16 Man Double Elimination"
|
||||
DoubleEliminationMatchGeneration.new(@tournament).generate_matches if @tournament.tournament_type == "Double Elimination 1-6"
|
||||
ModifiedSixteenManMatchGeneration.new(@tournament).generate_matches if @tournament.tournament_type.include? "Modified 16 Man Double Elimination"
|
||||
DoubleEliminationMatchGeneration.new(@tournament).generate_matches if @tournament.tournament_type.include? "Regular Double Elimination"
|
||||
postMatchCreationActions
|
||||
PoolToBracketMatchGeneration.new(@tournament).assignLoserNames if @tournament.tournament_type == "Pool to bracket"
|
||||
ModifiedSixteenManGenerateLoserNames.new(@tournament).assign_loser_names if @tournament.tournament_type == "Modified 16 Man Double Elimination"
|
||||
DoubleEliminationGenerateLoserNames.new(@tournament).assign_loser_names if @tournament.tournament_type == "Double Elimination 1-6"
|
||||
ModifiedSixteenManGenerateLoserNames.new(@tournament).assign_loser_names if @tournament.tournament_type.include? "Modified 16 Man Double Elimination"
|
||||
DoubleEliminationGenerateLoserNames.new(@tournament).assign_loser_names if @tournament.tournament_type.include? "Regular Double Elimination"
|
||||
end
|
||||
|
||||
def standardStartingActions
|
||||
|
||||
@@ -10,6 +10,7 @@ class ModifiedSixteenManGenerateLoserNames
|
||||
conso_round_2(matches_by_weight)
|
||||
conso_round_3(matches_by_weight)
|
||||
third_fourth(matches_by_weight)
|
||||
seventh_eighth(matches_by_weight)
|
||||
save_matches(matches_by_weight)
|
||||
matches_by_weight = @tournament.matches.where(weight_id: w.id).reload
|
||||
advance_bye_matches_championship(matches_by_weight)
|
||||
@@ -55,11 +56,17 @@ class ModifiedSixteenManGenerateLoserNames
|
||||
match.loser2_name = "Loser of #{matches.select{|m| m.bracket_position == "Semis"}.second.bout_number}"
|
||||
end
|
||||
end
|
||||
|
||||
def seventh_eighth(matches)
|
||||
matches.select{|m| m.bracket_position == "7/8"}.sort_by{|m| m.bracket_position_number}.each do |match|
|
||||
match.loser1_name = "Loser of #{matches.select{|m| m.bracket_position == "Conso Semis"}.first.bout_number}"
|
||||
match.loser2_name = "Loser of #{matches.select{|m| m.bracket_position == "Conso Semis"}.second.bout_number}"
|
||||
end
|
||||
end
|
||||
|
||||
def advance_bye_matches_championship(matches)
|
||||
matches.select{|m| m.round == 1 and m.bracket_position == "Bracket"}.sort_by{|m| m.bracket_position_number}.each do |match|
|
||||
if match.w1 == nil or match.w2 == nil
|
||||
puts match.bout_number
|
||||
match.finished = 1
|
||||
match.win_type = "BYE"
|
||||
if match.w1 != nil
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class ModifiedSixteenManMatchGeneration
|
||||
def initialize( tournament )
|
||||
@tournament = tournament
|
||||
@number_of_placers = @tournament.number_of_placers
|
||||
end
|
||||
|
||||
def generate_matches
|
||||
@@ -57,6 +58,9 @@ class ModifiedSixteenManMatchGeneration
|
||||
create_matchup(nil,nil,"1/2",1,5,weight)
|
||||
create_matchup(nil,nil,"3/4",1,5,weight)
|
||||
create_matchup(nil,nil,"5/6",1,5,weight)
|
||||
if @number_of_placers >= 8
|
||||
create_matchup(nil,nil,"7/8",1,5,weight)
|
||||
end
|
||||
end
|
||||
|
||||
def wrestler_with_seed(seed,weight)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class SixteenManDoubleEliminationMatchGeneration
|
||||
def initialize( weight )
|
||||
@weight = weight
|
||||
@number_of_placers = @weight.tournament.number_of_placers
|
||||
end
|
||||
|
||||
def generate_matches_for_weight
|
||||
|
||||
@@ -26,8 +26,8 @@ class CalculateWrestlerTeamScore
|
||||
|
||||
def placement_points
|
||||
return PoolBracketPlacementPoints.new(@wrestler).calcPoints if @tournament.tournament_type == "Pool to bracket"
|
||||
return ModifiedSixteenManPlacementPoints.new(@wrestler).calc_points if @tournament.tournament_type == "Modified 16 Man Double Elimination"
|
||||
return DoubleEliminationPlacementPoints.new(@wrestler).calc_points if @tournament.tournament_type == "Double Elimination 1-6"
|
||||
return ModifiedSixteenManPlacementPoints.new(@wrestler).calc_points if @tournament.tournament_type.include? "Modified 16 Man Double Elimination"
|
||||
return DoubleEliminationPlacementPoints.new(@wrestler).calc_points if @tournament.tournament_type.include? "Regular Double Elimination"
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
class DoubleEliminationPlacementPoints
|
||||
def initialize(wrestler)
|
||||
@wrestler = wrestler
|
||||
if wrestler.tournament.tournament_type == "Double Elimination 1-6"
|
||||
@number_of_placers = 6
|
||||
end
|
||||
@number_of_placers = @wrestler.tournament.number_of_placers
|
||||
end
|
||||
|
||||
def calc_points
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
class ModifiedSixteenManPlacementPoints
|
||||
def initialize(wrestler)
|
||||
@wrestler = wrestler
|
||||
@number_of_placers = 6
|
||||
@wrestler = wrestler
|
||||
@number_of_placers = @wrestler.tournament.number_of_placers
|
||||
end
|
||||
|
||||
def calc_points
|
||||
@@ -17,6 +18,10 @@ class ModifiedSixteenManPlacementPoints
|
||||
return PlacementPoints.new(@number_of_placers).fifthPlace
|
||||
elsif bracket_position_size("5/6") > 0
|
||||
return PlacementPoints.new(@number_of_placers).sixthPlace
|
||||
elsif won_bracket_position_size("7/8") > 0
|
||||
return PlacementPoints.new(@number_of_placers).seventhPlace
|
||||
elsif bracket_position_size("Conso Semis") > 0 and @number_of_placers >= 8
|
||||
return PlacementPoints.new(@number_of_placers).eighthPlace
|
||||
else
|
||||
return 0
|
||||
end
|
||||
|
||||
@@ -42,7 +42,8 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
<li><strong>Time Savers</strong></li>
|
||||
<li><%= link_to "Create High School Weights (106-285)" , "/tournaments/#{@tournament.id}/create_custom_weights?customValue=hs",data: { confirm: 'Are you sure? This will delete all current weights.' } %></li>
|
||||
<li><%= link_to "Create Boys High School Weights (106-285)" , "/tournaments/#{@tournament.id}/create_custom_weights?customValue=#{Weight::HS_WEIGHT_CLASSES}",data: { confirm: 'Are you sure? This will delete all current weights.' } %></li>
|
||||
<li><%= link_to "Create Girls High School Weights (101-235)" , "/tournaments/#{@tournament.id}/create_custom_weights?customValue=#{Weight::HS_GIRLS_WEIGHT_CLASSES}",data: { confirm: 'Are you sure? This will delete all current weights.' } %></li>
|
||||
<li><strong>Tournament Actions</strong></li>
|
||||
<li><%= link_to "Calculate Team Scores" , "/tournaments/#{@tournament.id}/calculate_team_scores", method: :post %></li>
|
||||
<li><%= link_to "Generate Brackets" , "/tournaments/#{@tournament.id}/generate_matches", data: { confirm: 'Are you sure? This will delete all current matches.' } %></li>
|
||||
|
||||
@@ -106,7 +106,7 @@ table.smallText tr td { font-size: 10px; }
|
||||
<%= render 'fourPoolSemiBracket' %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% elsif @tournament.tournament_type == "Modified 16 Man Double Elimination" %>
|
||||
<% elsif @tournament.tournament_type.include? "Modified 16 Man Double Elimination" %>
|
||||
<td valign="top" style="padding: 10px;">
|
||||
<%= render 'modified_sixteen_man_double_elimination_bracket' %>
|
||||
</td>
|
||||
|
||||
@@ -1,131 +1,48 @@
|
||||
<h4>Championship Bracket</h4>
|
||||
<main id="bracket">
|
||||
<ul class="round round-1">
|
||||
<% @matches.select{|m|m.bracket_position == "Bracket" and m.round == 1}.sort_by{|m| m.bracket_position_number}.each do |match| %>
|
||||
<li> </li>
|
||||
<li class="game game-top "><%= match.w1_bracket_name_round_one %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name_round_one %><span></span></li>
|
||||
<li> </li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul class="round round-2">
|
||||
<% @matches.select{|m|m.bracket_position == "Quarter"}.sort_by{|m| m.bracket_position_number}.each do |match| %>
|
||||
<li></li>
|
||||
<li class="game game-top "><%= match.w1_bracket_name %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name %><span></span></li>
|
||||
<li></li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul class="round round-3">
|
||||
<% @matches.select{|m|m.bracket_position == "Semis"}.sort_by{|m| m.bracket_position_number}.each do |match| %>
|
||||
<li></li>
|
||||
<li class="game game-top "><%= match.w1_bracket_name %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name %><span></span></li>
|
||||
<li></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul class="round round-4">
|
||||
<% @matches.select{|m|m.bracket_position == "1/2"}.each do |match| %>
|
||||
<li></li>
|
||||
<li class="game game-top "><%= match.w1_bracket_name %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name %><span></span></li>
|
||||
<li></li>
|
||||
|
||||
</ul>
|
||||
<ul class="round round-5">
|
||||
<li></li>
|
||||
<li class="bracket-winner"> <%= match.bracket_winner_name %> <span></span></li>
|
||||
1st
|
||||
<li></li>
|
||||
|
||||
</ul>
|
||||
<% end %>
|
||||
</main>
|
||||
<div class="bracket">
|
||||
<!--Round 1-->
|
||||
<% @round_matches = @matches.select{|m|m.bracket_position == "Bracket" and m.round == 1} %>
|
||||
<%= render 'bracket_round' %>
|
||||
<!--Round 2-->
|
||||
<% @round_matches = @matches.select{|m|m.bracket_position == "Quarter"} %>
|
||||
<%= render 'bracket_round' %>
|
||||
<!--Round 3-->
|
||||
<% @round_matches = @matches.select{|m|m.bracket_position == "Semis"} %>
|
||||
<%= render 'bracket_round' %>
|
||||
<!--Round 4-->
|
||||
<% @final_match = @matches.select{|m|m.bracket_position == "1/2"} %>
|
||||
<% @winner_place = "1st" %>
|
||||
<%= render 'bracket_final' %>
|
||||
</div>
|
||||
<h4>3/4 place match</h4>
|
||||
<main id="bracket">
|
||||
<ul class="round round-3">
|
||||
<% @matches.select{|m|m.bracket_position == "3/4"}.each do |match| %>
|
||||
<li> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_bracket_name %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name %><span></span></li>
|
||||
|
||||
<li> </li>
|
||||
|
||||
</ul>
|
||||
<ul class="round round-4">
|
||||
<li> </li>
|
||||
|
||||
<li class="bracket-winner"> <%= match.bracket_winner_name %> <span></span></li>
|
||||
3rd
|
||||
|
||||
<li> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</main>
|
||||
<div class="bracket">
|
||||
<!--Round 1-->
|
||||
<% @final_match = @matches.select{|m|m.bracket_position == "3/4"} %>
|
||||
<% @winner_place = "3rd" %>
|
||||
<%= render 'bracket_final' %>
|
||||
</div>
|
||||
<h4>Consolation Bracket</h4>
|
||||
<main id="bracket">
|
||||
<ul class="round round-1">
|
||||
<% @matches.select{|m|m.bracket_position == "Conso" and m.round == 2}.sort_by{|m| m.bracket_position_number}.each do |match| %>
|
||||
<li> </li>
|
||||
<li> </li>
|
||||
|
||||
|
||||
<li class="game game-top "><%= match.w1_bracket_name %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name %><span></span></li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul class="round round-2">
|
||||
<% @matches.select{|m|m.bracket_position == "Conso Quarter"}.sort_by{|m| m.bracket_position_number}.each do |match| %>
|
||||
<li> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_bracket_name %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name %><span></span></li>
|
||||
|
||||
<li> </li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul class="round round-3">
|
||||
<% @matches.select{|m|m.bracket_position == "Conso Semis"}.sort_by{|m| m.bracket_position_number}.each do |match| %>
|
||||
<li> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_bracket_name %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name %><span></span></li>
|
||||
<li> </li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul class="round round-4">
|
||||
<% @matches.select{|m|m.bracket_position == "5/6"}.each do |match| %>
|
||||
<li> </li>
|
||||
|
||||
<li class="game game-top "><%= match.w1_bracket_name %> <span></span></li>
|
||||
<li class="bout-number"><%= match.bout_number %> <%= match.bracket_score_string %> </li>
|
||||
<li class="game game-bottom "><%= match.w2_bracket_name %><span></span></li>
|
||||
|
||||
<li> </li>
|
||||
|
||||
</ul>
|
||||
<ul class="round round-5">
|
||||
<li> </li>
|
||||
|
||||
<li class="bracket-winner"> <%= match.bracket_winner_name %> <span></span></li>
|
||||
5th
|
||||
|
||||
<li> </li>
|
||||
|
||||
</ul>
|
||||
<% end %>
|
||||
</main>
|
||||
<div class="bracket">
|
||||
<!--Round 1-->
|
||||
<% @round_matches = @matches.select{|m|m.bracket_position == "Conso" and m.round == 2} %>
|
||||
<%= render 'bracket_round' %>
|
||||
<!--Round 2-->
|
||||
<% @round_matches = @matches.select{|m|m.bracket_position == "Conso Quarter"} %>
|
||||
<%= render 'bracket_round' %>
|
||||
<!--Round 3-->
|
||||
<% @round_matches = @matches.select{|m|m.bracket_position == "Conso Semis"} %>
|
||||
<%= render 'bracket_round' %>
|
||||
<!--Round 4-->
|
||||
<% @final_match = @matches.select{|m|m.bracket_position == "5/6"} %>
|
||||
<% @winner_place = "5th" %>
|
||||
<%= render 'bracket_final' %>
|
||||
</div>
|
||||
<% if @tournament.number_of_placers >= 8 %>
|
||||
<h4>7/8 place match</h4>
|
||||
<div class="bracket">
|
||||
<!--Round 1-->
|
||||
<% @final_match = @matches.select{|m|m.bracket_position == "7/8"} %>
|
||||
<% @winner_place = "7th" %>
|
||||
<%= render 'bracket_final' %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
<% cache ["#{@tournament.id}_all_brackets", @tournament] do %>
|
||||
<div id="exportable" >
|
||||
<%= render :file => 'tournaments/team_scores' %>
|
||||
<%= render :template => 'tournaments/team_scores' %>
|
||||
<% @tournament.weights.sort_by{|w| w.max}.each do |weight| %>
|
||||
<table class='pagebreak'>
|
||||
<tr>
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
<% end %>
|
||||
<% if @tournament.tournament_type == "Pool to bracket" %>
|
||||
<%= render 'pool_bracket_director_actions' %>
|
||||
<% elsif @tournament.tournament_type == "Modified 16 Man Double Elimination" or @tournament.tournament_type == "Double Elimination 1-6" %>
|
||||
<% elsif @tournament.tournament_type.include? "Modified 16 Man Double Elimination" or @tournament.tournament_type.include? "Regular Double Elimination" %>
|
||||
<%= render 'bracket_director_actions' %>
|
||||
<% end %>
|
||||
@@ -24,7 +24,7 @@
|
||||
<tr>
|
||||
<td><%= match.bout_number %></td>
|
||||
<td><%= match.bracket_position %></td>
|
||||
<td><%= match.w1_bracket_name %> vs <%= match.w2_bracket_name %></td>
|
||||
<td><%= match.w1_bracket_name.html_safe %> vs <%= match.w2_bracket_name.html_safe %></td>
|
||||
<td><%= match.finished %></td>
|
||||
<td><%= link_to 'Show', match, :class=>"btn btn-default btn-sm" %>
|
||||
<%= link_to 'Edit Wrestlers', edit_match_path(match), :class=>"btn btn-primary btn-sm" %>
|
||||
|
||||
@@ -11,5 +11,5 @@ if [ $# != 1 ]; then
|
||||
fi
|
||||
|
||||
docker build -t $1 -f ${project_dir}/deploy/rails-dev-Dockerfile ${project_dir}
|
||||
docker run -it -p 3000:3000 -v ${project_dir}:/rails $1 /bin/bash
|
||||
sudo chown -R ${USER}:${USER} ${project_dir}
|
||||
docker run --rm -it -p 3000:3000 -v ${project_dir}:/rails $1 /bin/bash
|
||||
sudo chown -R ${USER_ID}:${USER_ID} ${project_dir}
|
||||
@@ -2,4 +2,4 @@
|
||||
project_dir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))/.."
|
||||
|
||||
docker build -f ${project_dir}/deploy/rails-prod-Dockerfile -t wrestlingdevtests ${project_dir}/.
|
||||
docker run -it wrestlingdevtests bash /rails/bin/run-all-tests.sh
|
||||
docker run --rm -it wrestlingdevtests bash /rails/bin/run-all-tests.sh
|
||||
|
||||
@@ -33,8 +33,6 @@ module Wrestling
|
||||
DeviseController.respond_to :html, :json
|
||||
end
|
||||
|
||||
config.active_record.sqlite3.represent_boolean_as_integer = true
|
||||
|
||||
config.autoload_paths += %W(#{config.root}/app/services/tournament_services)
|
||||
config.autoload_paths += %W(#{config.root}/app/services/wrestler_services)
|
||||
config.autoload_paths += %W(#{config.root}/app/services/weight_services)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
Wrestling::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# allow all hostnames
|
||||
config.hosts.clear
|
||||
|
||||
# In the development environment your application's code is reloaded on
|
||||
# every request. This slows down response time but is perfect for development
|
||||
# since you don't have to restart the web server when you make code changes.
|
||||
@@ -32,9 +35,5 @@ Wrestling::Application.configure do
|
||||
#Bullet.alert = true
|
||||
#Bullet.console = true
|
||||
#Bullet.bullet_logger = true
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -54,7 +54,7 @@ Wrestling::Application.configure do
|
||||
|
||||
# Use a different cache store in production.
|
||||
# config.cache_store = :mem_cache_store
|
||||
config.cache_store = :dalli_store,
|
||||
config.cache_store = :mem_cache_store,
|
||||
(ENV["MEMCACHIER_SERVERS"] || "").split(","),
|
||||
{:username => ENV["MEMCACHIER_USERNAME"],
|
||||
:password => ENV["MEMCACHIER_PASSWORD"],
|
||||
|
||||
0
config/storage.yml
Normal file
0
config/storage.yml
Normal file
@@ -1,4 +1,4 @@
|
||||
FROM ruby:2.6.5
|
||||
FROM ruby:3.0.0
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -qq install -y \
|
||||
@@ -22,7 +22,8 @@ RUN gem install bundler
|
||||
RUN gem update --system
|
||||
ADD Gemfile* /tmp/
|
||||
WORKDIR /tmp
|
||||
RUN bundle install --jobs 4 --without production
|
||||
RUN bundle config set without 'production'
|
||||
RUN bundle install --jobs 4
|
||||
|
||||
RUN mkdir /rails
|
||||
WORKDIR /rails
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM ruby:2.6.5-slim
|
||||
FROM ruby:3.0.0-slim
|
||||
|
||||
#HEALTHCHECK --start-period=60s CMD curl http://127.0.0.1/
|
||||
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ModifiedDoubleEliminationSixPlacesManMatchGeneration < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
create_double_elim_tournament_single_weight(14, "Modified 16 Man Double Elimination 1-6")
|
||||
end
|
||||
|
||||
test "Match generation works" do
|
||||
assert @tournament.matches.count == 27
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "1/2"}.count == 1
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "3/4"}.count == 1
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "5/6"}.count == 1
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Bracket" and m.round == 1}.count == 8
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2}.count == 4
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Quarter"}.count == 4
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Semis"}.count == 2
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso Quarter"}.count == 4
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso Semis"}.count == 2
|
||||
end
|
||||
|
||||
test "Seeded wrestlers have correct first line" do
|
||||
@tournament.matches.reload
|
||||
match1 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 1}.first
|
||||
match2 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 2}.first
|
||||
match3 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 3}.first
|
||||
match4 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 4}.first
|
||||
match5 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 5}.first
|
||||
match6 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 6}.first
|
||||
match7 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 7}.first
|
||||
match8 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 8}.first
|
||||
|
||||
assert match1.wrestler1.bracket_line == 1
|
||||
assert match1.loser2_name == "BYE"
|
||||
|
||||
assert match2.wrestler1.bracket_line == 8
|
||||
assert match2.wrestler2.bracket_line == 9
|
||||
|
||||
assert match3.wrestler1.bracket_line == 5
|
||||
assert match3.wrestler2.bracket_line == 12
|
||||
|
||||
assert match4.wrestler1.bracket_line == 4
|
||||
assert match4.wrestler2.bracket_line == 14
|
||||
|
||||
assert match5.wrestler1.bracket_line == 3
|
||||
assert match5.wrestler2.bracket_line == 13
|
||||
|
||||
assert match6.wrestler1.bracket_line == 6
|
||||
assert match6.wrestler2.bracket_line == 11
|
||||
|
||||
assert match7.wrestler1.bracket_line == 7
|
||||
assert match7.wrestler2.bracket_line == 10
|
||||
|
||||
assert match8.wrestler1.bracket_line == 2
|
||||
assert match8.loser2_name == "BYE"
|
||||
end
|
||||
|
||||
test "Byes are advanced correctly" do
|
||||
@tournament.matches.reload
|
||||
match1 = @tournament.matches.select{|match| match.round == 2 and match.bracket_position == "Quarter" and match.bracket_position_number == 1}.first
|
||||
match2 = @tournament.matches.select{|match| match.round == 2 and match.bracket_position == "Quarter" and match.bracket_position_number == 4}.first
|
||||
|
||||
assert match1.wrestler1.name == "Test1"
|
||||
assert match2.wrestler2.name == "Test2"
|
||||
end
|
||||
|
||||
test "Loser names set up correctly" do
|
||||
@tournament.matches.reload
|
||||
match1 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 1}.first
|
||||
match2 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 2}.first
|
||||
match3 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 3}.first
|
||||
match4 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 4}.first
|
||||
match5 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 5}.first
|
||||
match6 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 6}.first
|
||||
match7 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 7}.first
|
||||
match8 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 8}.first
|
||||
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2 && m.bracket_position_number == 1}.first.loser1_name == "BYE"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2 && m.bracket_position_number == 1}.first.loser2_name == "Loser of #{match2.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2 && m.bracket_position_number == 2}.first.loser1_name == "Loser of #{match3.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2 && m.bracket_position_number == 2}.first.loser2_name == "Loser of #{match4.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2 && m.bracket_position_number == 3}.first.loser1_name == "Loser of #{match5.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2 && m.bracket_position_number == 3}.first.loser2_name == "Loser of #{match6.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2 && m.bracket_position_number == 4}.first.loser1_name == "Loser of #{match7.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2 && m.bracket_position_number == 4}.first.loser2_name == "BYE"
|
||||
|
||||
quarter1 = @tournament.matches.select{|match| match.bracket_position == "Quarter" and match.bracket_position_number == 1}.first
|
||||
quarter2 = @tournament.matches.select{|match| match.bracket_position == "Quarter" and match.bracket_position_number == 2}.first
|
||||
quarter3 = @tournament.matches.select{|match| match.bracket_position == "Quarter" and match.bracket_position_number == 3}.first
|
||||
quarter4 = @tournament.matches.select{|match| match.bracket_position == "Quarter" and match.bracket_position_number == 4}.first
|
||||
consoround2match1 = @tournament.matches.select{|match| match.bracket_position == "Conso Quarter" and match.round == 3 && match.bracket_position_number == 1}.first
|
||||
consoround2match2 = @tournament.matches.select{|match| match.bracket_position == "Conso Quarter" and match.round == 3 && match.bracket_position_number == 2}.first
|
||||
consoround2match3 = @tournament.matches.select{|match| match.bracket_position == "Conso Quarter" and match.round == 3 && match.bracket_position_number == 3}.first
|
||||
consoround2match4 = @tournament.matches.select{|match| match.bracket_position == "Conso Quarter" and match.round == 3 && match.bracket_position_number == 4}.first
|
||||
|
||||
assert consoround2match1.loser1_name == "Loser of #{quarter4.bout_number}"
|
||||
assert consoround2match2.loser1_name == "Loser of #{quarter3.bout_number}"
|
||||
assert consoround2match3.loser1_name == "Loser of #{quarter2.bout_number}"
|
||||
assert consoround2match4.loser1_name == "Loser of #{quarter1.bout_number}"
|
||||
|
||||
semis1 = @tournament.matches.select{|match| match.bracket_position == "Semis" and match.bracket_position_number == 1}.first
|
||||
semis2 = @tournament.matches.select{|match| match.bracket_position == "Semis" and match.bracket_position_number == 2}.first
|
||||
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "3/4" && m.bracket_position_number == 1}.first.loser1_name == "Loser of #{semis1.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "3/4" && m.bracket_position_number == 1}.first.loser2_name == "Loser of #{semis2.bout_number}"
|
||||
end
|
||||
|
||||
test "Placement points are given when moving through bracket" do
|
||||
match = @tournament.matches.select{|m| m.bracket_position == "Semis"}.first
|
||||
wrestler = get_wrestler_by_name("Test1")
|
||||
match.w1 = wrestler.id
|
||||
match.save
|
||||
|
||||
assert wrestler.reload.placement_points == 7
|
||||
end
|
||||
|
||||
test "Run through all matches works" do
|
||||
@tournament.matches.sort_by{ |match| match.bout_number }.each do |match|
|
||||
match.reload
|
||||
if match.finished != 1 and match.w1 and match.w2
|
||||
match.winner_id = match.w1
|
||||
match.win_type = "Decision"
|
||||
match.score = "0-0"
|
||||
match.finished = 1
|
||||
match.save
|
||||
end
|
||||
end
|
||||
assert @tournament.matches.reload.select{|m| m.finished == 0}.count == 0
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,104 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ModifiedDoubleEliminationSixPlacesRunThrough < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
end
|
||||
|
||||
def winner_by_name(winner_name,match)
|
||||
wrestler = @tournament.weights.first.wrestlers.select{|w| w.name == winner_name}.first
|
||||
match.winner_id = wrestler.id
|
||||
match.finished = 1
|
||||
match.win_type = "Decision"
|
||||
match.score = "0-0"
|
||||
match.save
|
||||
end
|
||||
|
||||
test "16 man modified double elimination placing 1-6" do
|
||||
@tournament = create_double_elim_tournament_single_weight(14, "Modified 16 Man Double Elimination 1-6")
|
||||
matches = @tournament.matches.reload
|
||||
|
||||
round1 = matches.select{|m| m.round == 1}
|
||||
winner_by_name("Test9", round1.select{|m| m.bracket_position_number == 2}.first)
|
||||
winner_by_name("Test5", round1.select{|m| m.bracket_position_number == 3}.first)
|
||||
winner_by_name("Test4", round1.select{|m| m.bracket_position_number == 4}.first)
|
||||
winner_by_name("Test13", round1.select{|m| m.bracket_position_number == 5}.first)
|
||||
winner_by_name("Test6", round1.select{|m| m.bracket_position_number == 6}.first)
|
||||
winner_by_name("Test10", round1.select{|m| m.bracket_position_number == 7}.first)
|
||||
|
||||
quarter = matches.select{|m| m.bracket_position == "Quarter"}.sort_by{|m| m.bracket_position_number}
|
||||
assert quarter.first.reload.wrestler1.name == "Test1"
|
||||
assert quarter.first.reload.wrestler2.name == "Test9"
|
||||
assert quarter.second.reload.wrestler1.name == "Test5"
|
||||
assert quarter.second.reload.wrestler2.name == "Test4"
|
||||
assert quarter.third.reload.wrestler1.name == "Test13"
|
||||
assert quarter.third.reload.wrestler2.name == "Test6"
|
||||
assert quarter.fourth.reload.wrestler1.name == "Test10"
|
||||
assert quarter.fourth.reload.wrestler2.name == "Test2"
|
||||
|
||||
conso_round2 = matches.select{|m| m.bracket_position == "Conso" and m.round == 2}.sort_by{|m| m.bracket_position_number}
|
||||
assert conso_round2.first.reload.wrestler2.name == "Test8"
|
||||
assert conso_round2.second.reload.wrestler1.name == "Test12"
|
||||
assert conso_round2.second.reload.wrestler2.name == "Test14"
|
||||
assert conso_round2.third.reload.wrestler1.name == "Test3"
|
||||
assert conso_round2.third.reload.wrestler2.name == "Test11"
|
||||
assert conso_round2.fourth.reload.wrestler1.name == "Test7"
|
||||
|
||||
winner_by_name("Test1", quarter.first)
|
||||
winner_by_name("Test5", quarter.second)
|
||||
winner_by_name("Test13", quarter.third)
|
||||
winner_by_name("Test10", quarter.fourth)
|
||||
winner_by_name("Test12", conso_round2.second)
|
||||
winner_by_name("Test3", conso_round2.third)
|
||||
|
||||
semis = matches.select{|m| m.bracket_position == "Semis"}.sort_by{|m| m.bracket_position_number}
|
||||
assert semis.first.reload.wrestler1.name == "Test1"
|
||||
assert semis.first.reload.wrestler2.name == "Test5"
|
||||
assert semis.second.reload.wrestler1.name == "Test13"
|
||||
assert semis.second.reload.wrestler2.name == "Test10"
|
||||
|
||||
conso_quarter = matches.select{|m| m.bracket_position == "Conso Quarter"}.sort_by{|m| m.bracket_position_number}
|
||||
assert conso_quarter.first.reload.wrestler1.name == "Test2"
|
||||
assert conso_quarter.first.reload.wrestler2.name == "Test8"
|
||||
assert conso_quarter.second.reload.wrestler1.name == "Test6"
|
||||
assert conso_quarter.second.reload.wrestler2.name == "Test12"
|
||||
assert conso_quarter.third.reload.wrestler1.name == "Test4"
|
||||
assert conso_quarter.third.reload.wrestler2.name == "Test3"
|
||||
assert conso_quarter.fourth.reload.wrestler1.name == "Test9"
|
||||
assert conso_quarter.fourth.reload.wrestler2.name == "Test7"
|
||||
|
||||
winner_by_name("Test5",semis.first)
|
||||
winner_by_name("Test10",semis.second)
|
||||
winner_by_name("Test2", conso_quarter.first)
|
||||
winner_by_name("Test12", conso_quarter.second)
|
||||
winner_by_name("Test4", conso_quarter.third)
|
||||
winner_by_name("Test7", conso_quarter.fourth)
|
||||
|
||||
conso_semis = matches.select{|m| m.bracket_position == "Conso Semis"}.sort_by{|m| m.bracket_position_number}
|
||||
assert conso_semis.first.reload.wrestler1.name == "Test2"
|
||||
assert conso_semis.first.reload.wrestler2.name == "Test12"
|
||||
assert conso_semis.second.reload.wrestler1.name == "Test4"
|
||||
assert conso_semis.second.reload.wrestler2.name == "Test7"
|
||||
|
||||
winner_by_name("Test2",conso_semis.first)
|
||||
winner_by_name("Test4",conso_semis.second)
|
||||
|
||||
first_finals = matches.select{|m| m.bracket_position == "1/2"}.first
|
||||
third_finals = matches.select{|m| m.bracket_position == "3/4"}.first
|
||||
fifth_finals = matches.select{|m| m.bracket_position == "5/6"}.first
|
||||
|
||||
assert first_finals.reload.wrestler1.name == "Test5"
|
||||
assert first_finals.reload.wrestler2.name == "Test10"
|
||||
|
||||
assert third_finals.reload.wrestler1.name == "Test1"
|
||||
assert third_finals.reload.wrestler2.name == "Test13"
|
||||
|
||||
assert fifth_finals.reload.wrestler1.name == "Test2"
|
||||
assert fifth_finals.reload.wrestler2.name == "Test4"
|
||||
|
||||
# DEBUG
|
||||
# matches.sort_by{|m| m.bout_number}.each do |match|
|
||||
# match.reload
|
||||
# puts "Round #{match.round} #{match.w1_bracket_name} vs #{match.w2_bracket_name}"
|
||||
# end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,142 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ModifiedDoubleEliminationEightPlacesManMatchGeneration < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
create_double_elim_tournament_single_weight(14, "Modified 16 Man Double Elimination 1-8")
|
||||
end
|
||||
|
||||
test "Match generation works" do
|
||||
assert @tournament.matches.count == 28
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "1/2"}.count == 1
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "3/4"}.count == 1
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "5/6"}.count == 1
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "7/8"}.count == 1
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Bracket" and m.round == 1}.count == 8
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Quarter"}.count == 4
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Semis"}.count == 2
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2}.count == 4
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso Quarter"}.count == 4
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso Semis"}.count == 2
|
||||
end
|
||||
|
||||
test "Seeded wrestlers have correct first line" do
|
||||
@tournament.matches.reload
|
||||
match1 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 1}.first
|
||||
match2 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 2}.first
|
||||
match3 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 3}.first
|
||||
match4 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 4}.first
|
||||
match5 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 5}.first
|
||||
match6 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 6}.first
|
||||
match7 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 7}.first
|
||||
match8 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 8}.first
|
||||
|
||||
assert match1.wrestler1.bracket_line == 1
|
||||
assert match1.loser2_name == "BYE"
|
||||
|
||||
assert match2.wrestler1.bracket_line == 8
|
||||
assert match2.wrestler2.bracket_line == 9
|
||||
|
||||
assert match3.wrestler1.bracket_line == 5
|
||||
assert match3.wrestler2.bracket_line == 12
|
||||
|
||||
assert match4.wrestler1.bracket_line == 4
|
||||
assert match4.wrestler2.bracket_line == 14
|
||||
|
||||
assert match5.wrestler1.bracket_line == 3
|
||||
assert match5.wrestler2.bracket_line == 13
|
||||
|
||||
assert match6.wrestler1.bracket_line == 6
|
||||
assert match6.wrestler2.bracket_line == 11
|
||||
|
||||
assert match7.wrestler1.bracket_line == 7
|
||||
assert match7.wrestler2.bracket_line == 10
|
||||
|
||||
assert match8.wrestler1.bracket_line == 2
|
||||
assert match8.loser2_name == "BYE"
|
||||
end
|
||||
|
||||
test "Byes are advanced correctly" do
|
||||
@tournament.matches.reload
|
||||
match1 = @tournament.matches.select{|match| match.round == 2 and match.bracket_position == "Quarter" and match.bracket_position_number == 1}.first
|
||||
match2 = @tournament.matches.select{|match| match.round == 2 and match.bracket_position == "Quarter" and match.bracket_position_number == 4}.first
|
||||
|
||||
assert match1.wrestler1.name == "Test1"
|
||||
assert match2.wrestler2.name == "Test2"
|
||||
end
|
||||
|
||||
test "Loser names set up correctly" do
|
||||
@tournament.matches.reload
|
||||
match1 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 1}.first
|
||||
match2 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 2}.first
|
||||
match3 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 3}.first
|
||||
match4 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 4}.first
|
||||
match5 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 5}.first
|
||||
match6 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 6}.first
|
||||
match7 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 7}.first
|
||||
match8 = @tournament.matches.select{|match| match.round == 1 and match.bracket_position_number == 8}.first
|
||||
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2 && m.bracket_position_number == 1}.first.loser1_name == "BYE"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2 && m.bracket_position_number == 1}.first.loser2_name == "Loser of #{match2.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2 && m.bracket_position_number == 2}.first.loser1_name == "Loser of #{match3.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2 && m.bracket_position_number == 2}.first.loser2_name == "Loser of #{match4.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2 && m.bracket_position_number == 3}.first.loser1_name == "Loser of #{match5.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2 && m.bracket_position_number == 3}.first.loser2_name == "Loser of #{match6.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2 && m.bracket_position_number == 4}.first.loser1_name == "Loser of #{match7.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "Conso" and m.round == 2 && m.bracket_position_number == 4}.first.loser2_name == "BYE"
|
||||
|
||||
quarter1 = @tournament.matches.select{|match| match.bracket_position == "Quarter" and match.bracket_position_number == 1}.first
|
||||
quarter2 = @tournament.matches.select{|match| match.bracket_position == "Quarter" and match.bracket_position_number == 2}.first
|
||||
quarter3 = @tournament.matches.select{|match| match.bracket_position == "Quarter" and match.bracket_position_number == 3}.first
|
||||
quarter4 = @tournament.matches.select{|match| match.bracket_position == "Quarter" and match.bracket_position_number == 4}.first
|
||||
consoround2match1 = @tournament.matches.select{|match| match.bracket_position == "Conso Quarter" and match.round == 3 && match.bracket_position_number == 1}.first
|
||||
consoround2match2 = @tournament.matches.select{|match| match.bracket_position == "Conso Quarter" and match.round == 3 && match.bracket_position_number == 2}.first
|
||||
consoround2match3 = @tournament.matches.select{|match| match.bracket_position == "Conso Quarter" and match.round == 3 && match.bracket_position_number == 3}.first
|
||||
consoround2match4 = @tournament.matches.select{|match| match.bracket_position == "Conso Quarter" and match.round == 3 && match.bracket_position_number == 4}.first
|
||||
|
||||
assert consoround2match1.loser1_name == "Loser of #{quarter4.bout_number}"
|
||||
assert consoround2match2.loser1_name == "Loser of #{quarter3.bout_number}"
|
||||
assert consoround2match3.loser1_name == "Loser of #{quarter2.bout_number}"
|
||||
assert consoround2match4.loser1_name == "Loser of #{quarter1.bout_number}"
|
||||
|
||||
semis1 = @tournament.matches.select{|match| match.bracket_position == "Semis" and match.bracket_position_number == 1}.first
|
||||
semis2 = @tournament.matches.select{|match| match.bracket_position == "Semis" and match.bracket_position_number == 2}.first
|
||||
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "3/4" && m.bracket_position_number == 1}.first.loser1_name == "Loser of #{semis1.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "3/4" && m.bracket_position_number == 1}.first.loser2_name == "Loser of #{semis2.bout_number}"
|
||||
|
||||
consosemis1 = @tournament.matches.select{|match| match.bracket_position == "Conso Semis" and match.bracket_position_number == 1}.first
|
||||
consosemis2 = @tournament.matches.select{|match| match.bracket_position == "Conso Semis" and match.bracket_position_number == 2}.first
|
||||
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "7/8" && m.bracket_position_number == 1}.first.loser1_name == "Loser of #{consosemis1.bout_number}"
|
||||
assert @tournament.matches.select{|m| m.bracket_position == "7/8" && m.bracket_position_number == 1}.first.loser2_name == "Loser of #{consosemis2.bout_number}"
|
||||
end
|
||||
|
||||
test "Placement points are given when moving through bracket" do
|
||||
match = @tournament.matches.select{|m| m.bracket_position == "Semis"}.first
|
||||
wrestler = get_wrestler_by_name("Test1")
|
||||
match.w1 = wrestler.id
|
||||
match.save
|
||||
|
||||
match2 = @tournament.matches.select{|m| m.bracket_position == "Conso Semis"}.first
|
||||
wrestler2 = get_wrestler_by_name("Test2")
|
||||
match2.w1 = wrestler2.id
|
||||
match2.save
|
||||
|
||||
assert wrestler.reload.placement_points == 7
|
||||
assert wrestler2.reload.placement_points == 1
|
||||
end
|
||||
|
||||
test "Run through all matches works" do
|
||||
@tournament.matches.sort_by{ |match| match.bout_number }.each do |match|
|
||||
match.reload
|
||||
if match.finished != 1 and match.w1 and match.w2
|
||||
match.winner_id = match.w1
|
||||
match.win_type = "Decision"
|
||||
match.score = "0-0"
|
||||
match.finished = 1
|
||||
match.save
|
||||
end
|
||||
end
|
||||
assert @tournament.matches.reload.select{|m| m.finished == 0}.count == 0
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,108 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ModifiedDoubleEliminationEightPlacesRunThrough < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
end
|
||||
|
||||
def winner_by_name(winner_name,match)
|
||||
wrestler = @tournament.weights.first.wrestlers.select{|w| w.name == winner_name}.first
|
||||
match.winner_id = wrestler.id
|
||||
match.finished = 1
|
||||
match.win_type = "Decision"
|
||||
match.score = "0-0"
|
||||
match.save
|
||||
end
|
||||
|
||||
test "16 man modified double elimination placing 1-8" do
|
||||
@tournament = create_double_elim_tournament_single_weight(14, "Modified 16 Man Double Elimination 1-8")
|
||||
matches = @tournament.matches.reload
|
||||
|
||||
round1 = matches.select{|m| m.round == 1}
|
||||
winner_by_name("Test9", round1.select{|m| m.bracket_position_number == 2}.first)
|
||||
winner_by_name("Test5", round1.select{|m| m.bracket_position_number == 3}.first)
|
||||
winner_by_name("Test4", round1.select{|m| m.bracket_position_number == 4}.first)
|
||||
winner_by_name("Test13", round1.select{|m| m.bracket_position_number == 5}.first)
|
||||
winner_by_name("Test6", round1.select{|m| m.bracket_position_number == 6}.first)
|
||||
winner_by_name("Test10", round1.select{|m| m.bracket_position_number == 7}.first)
|
||||
|
||||
quarter = matches.select{|m| m.bracket_position == "Quarter"}.sort_by{|m| m.bracket_position_number}
|
||||
assert quarter.first.reload.wrestler1.name == "Test1"
|
||||
assert quarter.first.reload.wrestler2.name == "Test9"
|
||||
assert quarter.second.reload.wrestler1.name == "Test5"
|
||||
assert quarter.second.reload.wrestler2.name == "Test4"
|
||||
assert quarter.third.reload.wrestler1.name == "Test13"
|
||||
assert quarter.third.reload.wrestler2.name == "Test6"
|
||||
assert quarter.fourth.reload.wrestler1.name == "Test10"
|
||||
assert quarter.fourth.reload.wrestler2.name == "Test2"
|
||||
|
||||
conso_round2 = matches.select{|m| m.bracket_position == "Conso" and m.round == 2}.sort_by{|m| m.bracket_position_number}
|
||||
assert conso_round2.first.reload.wrestler2.name == "Test8"
|
||||
assert conso_round2.second.reload.wrestler1.name == "Test12"
|
||||
assert conso_round2.second.reload.wrestler2.name == "Test14"
|
||||
assert conso_round2.third.reload.wrestler1.name == "Test3"
|
||||
assert conso_round2.third.reload.wrestler2.name == "Test11"
|
||||
assert conso_round2.fourth.reload.wrestler1.name == "Test7"
|
||||
|
||||
winner_by_name("Test1", quarter.first)
|
||||
winner_by_name("Test5", quarter.second)
|
||||
winner_by_name("Test13", quarter.third)
|
||||
winner_by_name("Test10", quarter.fourth)
|
||||
winner_by_name("Test12", conso_round2.second)
|
||||
winner_by_name("Test3", conso_round2.third)
|
||||
|
||||
semis = matches.select{|m| m.bracket_position == "Semis"}.sort_by{|m| m.bracket_position_number}
|
||||
assert semis.first.reload.wrestler1.name == "Test1"
|
||||
assert semis.first.reload.wrestler2.name == "Test5"
|
||||
assert semis.second.reload.wrestler1.name == "Test13"
|
||||
assert semis.second.reload.wrestler2.name == "Test10"
|
||||
|
||||
conso_quarter = matches.select{|m| m.bracket_position == "Conso Quarter"}.sort_by{|m| m.bracket_position_number}
|
||||
assert conso_quarter.first.reload.wrestler1.name == "Test2"
|
||||
assert conso_quarter.first.reload.wrestler2.name == "Test8"
|
||||
assert conso_quarter.second.reload.wrestler1.name == "Test6"
|
||||
assert conso_quarter.second.reload.wrestler2.name == "Test12"
|
||||
assert conso_quarter.third.reload.wrestler1.name == "Test4"
|
||||
assert conso_quarter.third.reload.wrestler2.name == "Test3"
|
||||
assert conso_quarter.fourth.reload.wrestler1.name == "Test9"
|
||||
assert conso_quarter.fourth.reload.wrestler2.name == "Test7"
|
||||
|
||||
winner_by_name("Test5",semis.first)
|
||||
winner_by_name("Test10",semis.second)
|
||||
winner_by_name("Test2", conso_quarter.first)
|
||||
winner_by_name("Test12", conso_quarter.second)
|
||||
winner_by_name("Test4", conso_quarter.third)
|
||||
winner_by_name("Test7", conso_quarter.fourth)
|
||||
|
||||
conso_semis = matches.select{|m| m.bracket_position == "Conso Semis"}.sort_by{|m| m.bracket_position_number}
|
||||
assert conso_semis.first.reload.wrestler1.name == "Test2"
|
||||
assert conso_semis.first.reload.wrestler2.name == "Test12"
|
||||
assert conso_semis.second.reload.wrestler1.name == "Test4"
|
||||
assert conso_semis.second.reload.wrestler2.name == "Test7"
|
||||
|
||||
winner_by_name("Test2",conso_semis.first)
|
||||
winner_by_name("Test4",conso_semis.second)
|
||||
|
||||
first_finals = matches.select{|m| m.bracket_position == "1/2"}.first
|
||||
third_finals = matches.select{|m| m.bracket_position == "3/4"}.first
|
||||
fifth_finals = matches.select{|m| m.bracket_position == "5/6"}.first
|
||||
seventh_finals = matches.select{|m| m.bracket_position == "7/8"}.first
|
||||
|
||||
assert first_finals.reload.wrestler1.name == "Test5"
|
||||
assert first_finals.reload.wrestler2.name == "Test10"
|
||||
|
||||
assert third_finals.reload.wrestler1.name == "Test1"
|
||||
assert third_finals.reload.wrestler2.name == "Test13"
|
||||
|
||||
assert fifth_finals.reload.wrestler1.name == "Test2"
|
||||
assert fifth_finals.reload.wrestler2.name == "Test4"
|
||||
|
||||
assert seventh_finals.reload.wrestler1.name == "Test12"
|
||||
assert seventh_finals.reload.wrestler2.name == "Test7"
|
||||
|
||||
# DEBUG
|
||||
# matches.sort_by{|m| m.bout_number}.each do |match|
|
||||
# match.reload
|
||||
# puts "Round #{match.round} #{match.w1_bracket_name} vs #{match.w2_bracket_name}"
|
||||
# end
|
||||
end
|
||||
end
|
||||
@@ -8,6 +8,6 @@ class MatTest < ActiveSupport::TestCase
|
||||
test "Mat validations" do
|
||||
mat = Mat.new
|
||||
assert_not mat.valid?
|
||||
assert_equal [:name], mat.errors.keys
|
||||
assert_equal [:name], mat.errors.attribute_names
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,6 +8,6 @@ class SchoolTest < ActiveSupport::TestCase
|
||||
test "School validations" do
|
||||
school = School.new
|
||||
assert_not school.valid?
|
||||
assert_equal [:name], school.errors.keys
|
||||
assert_equal [:name], school.errors.attribute_names
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,6 +9,22 @@ class TournamentTest < ActiveSupport::TestCase
|
||||
test "Tournament validations" do
|
||||
tourney = Tournament.new
|
||||
assert_not tourney.valid?
|
||||
assert_equal [:date, :name, :tournament_type, :address, :director, :director_email], tourney.errors.keys
|
||||
assert_equal [:date, :name, :tournament_type, :address, :director, :director_email], tourney.errors.attribute_names
|
||||
end
|
||||
|
||||
test "Tournament create_pre_defined_weights High School Boys Weights" do
|
||||
tournament = Tournament.find(1)
|
||||
tournament.create_pre_defined_weights(Weight::HS_WEIGHT_CLASSES.split(","))
|
||||
Weight::HS_WEIGHT_CLASSES.split(",").each do |weight|
|
||||
assert tournament.weights.select{|w| w.max == weight.to_i}.count == 1
|
||||
end
|
||||
end
|
||||
|
||||
test "Tournament create_pre_defined_weights High School Girls Weights" do
|
||||
tournament = Tournament.find(1)
|
||||
tournament.create_pre_defined_weights(Weight::HS_GIRLS_WEIGHT_CLASSES.split(","))
|
||||
Weight::HS_GIRLS_WEIGHT_CLASSES.split(",").each do |weight|
|
||||
assert tournament.weights.select{|w| w.max == weight.to_i}.count == 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,6 +8,6 @@ class WeightTest < ActiveSupport::TestCase
|
||||
test "Weight validations" do
|
||||
weight = Weight.new
|
||||
assert_not weight.valid?
|
||||
assert_equal [:max], weight.errors.keys
|
||||
assert_equal [:max], weight.errors.attribute_names
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,6 +8,6 @@ class WrestlerTest < ActiveSupport::TestCase
|
||||
test "Wrestler validations" do
|
||||
wrestler = Wrestler.new
|
||||
assert_not wrestler.valid?
|
||||
assert_equal [:name, :weight_id, :school_id], wrestler.errors.keys
|
||||
assert_equal [:name, :weight_id, :school_id], wrestler.errors.attribute_names
|
||||
end
|
||||
end
|
||||
|
||||
@@ -41,7 +41,29 @@ class ActiveSupport::TestCase
|
||||
@tournament.address = "some place"
|
||||
@tournament.director = "some guy"
|
||||
@tournament.director_email= "test@test.com"
|
||||
@tournament.tournament_type = "Double Elimination 1-6"
|
||||
@tournament.tournament_type = "Regular Double Elimination 1-6"
|
||||
@tournament.date = "2015-12-30"
|
||||
@tournament.save
|
||||
@school = School.new
|
||||
@school.name = "Test"
|
||||
@school.tournament_id = @tournament.id
|
||||
@school.save
|
||||
@weight = Weight.new
|
||||
@weight.max = 106
|
||||
@weight.tournament_id = @tournament.id
|
||||
@weight.save
|
||||
create_wrestlers_for_weight_for_double_elim(@weight, @school, number_of_wrestlers, 1)
|
||||
GenerateTournamentMatches.new(@tournament).generate
|
||||
return @tournament
|
||||
end
|
||||
|
||||
def create_double_elim_tournament_single_weight(number_of_wrestlers, tournament_type)
|
||||
@tournament = Tournament.new
|
||||
@tournament.name = "Test Tournament"
|
||||
@tournament.address = "some place"
|
||||
@tournament.director = "some guy"
|
||||
@tournament.director_email= "test@test.com"
|
||||
@tournament.tournament_type = tournament_type
|
||||
@tournament.date = "2015-12-30"
|
||||
@tournament.save
|
||||
@school = School.new
|
||||
|
||||
Reference in New Issue
Block a user