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

Added a rake task for finishing all matches and updated the readme

This commit is contained in:
2019-01-30 13:34:58 +00:00
parent 71c8a0dc99
commit 523e124c47
2 changed files with 22 additions and 14 deletions

View File

@@ -16,22 +16,18 @@ MIT License
<b>Development details:</b>
* Ruby 2.4.0
* Ruby 2.5.1
* Rails 5.1.1
* Rails 5.2.2
* Install gems without production <tt>bundle install --without production</tt>
* Set local development variables for the applicaiton to work
<tt>export WRESTLINGDEV_SECRET_KEY_BASE=077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2</tt>
<tt>export WRESTLINGDEV_DEVISE_SECRET_KEY=2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa</tt>
* Test with minitest <tt>rake test</tt>
* Seeds created for development <tt>rake db:seed</tt>
* Finish all matches from seed data (this take ~ 5 minutes) <tt>rake finish_seed_tournament</tt>
* Development login email: <tt>test@test.com</tt> password: <tt>password</tt>
<b>Docker instructions:</b>
@@ -72,9 +68,4 @@ MIT License
<tt>MEMCACHIER_USERNAME=memcachier_username this is only needed for caching</tt>
* Production docker image: Run <tt>bash rails-prod.sh wrestlingapp</tt>. This will create a self-signed ssl certificate and set up wrestlingapp on passenger/apache. The container will run with port 80 and port 443 open and will have a restart policy of always.
<b>Public Trello page:</b>
<tt>https://trello.com/b/OIF9s2Gw</tt>
* Production docker image: Run <tt>bash rails-prod.sh wrestlingapp</tt>. This will create a self-signed ssl certificate and set up wrestlingapp on passenger/apache. The container will run with port 80 and port 443 open and will have a restart policy of always.

View File

@@ -0,0 +1,17 @@
task :finish_seed_tournament => :environment do
@tournament = Tournament.where(:id => 200).includes(:schools,:weights,:mats,:matches,:user,:wrestlers).first
GenerateTournamentMatches.new(@tournament).generate
(1..@tournament.reload.total_rounds).each do |round|
@tournament.reload.matches_by_round(round).each do |match|
match.reload
if match.wrestler1.bracket_line < match.wrestler2.bracket_line
match.winner_id = match.w1
else
match.winner_id = match.w2
end
match.finished = 1
match.score = "2-1"
match.save
end
end
end