From 96d911ad0909b77b2e416d585481b4b021ee1865 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Mon, 11 Dec 2017 07:57:26 -0500 Subject: [PATCH 1/5] Updated to ruby 2.4.2 and rails 5.1.4 --- Gemfile | 8 +-- Gemfile.lock | 135 +++++++++++++++++++++--------------------- rails-dev-Dockerfile | 2 +- rails-prod-Dockerfile | 2 +- 4 files changed, 74 insertions(+), 73 deletions(-) diff --git a/Gemfile b/Gemfile index cb9522d..2457e8d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source 'https://rubygems.org' -ruby '2.4.0' +ruby '2.4.2' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '5.1.1' +gem 'rails', '5.1.4' # Use sqlite3 as the database for Active Record gem 'sqlite3', :group => :development @@ -55,8 +55,8 @@ gem 'delayed_job_active_record' gem 'puma' group :development do - gem 'rubocop' + gem 'rubocop' gem 'bullet' gem 'brakeman' end - + diff --git a/Gemfile.lock b/Gemfile.lock index e78c9a0..ee86618 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,39 +1,39 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.1.1) - actionpack (= 5.1.1) + actioncable (5.1.4) + actionpack (= 5.1.4) nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.1.1) - actionpack (= 5.1.1) - actionview (= 5.1.1) - activejob (= 5.1.1) + actionmailer (5.1.4) + actionpack (= 5.1.4) + actionview (= 5.1.4) + activejob (= 5.1.4) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.1.1) - actionview (= 5.1.1) - activesupport (= 5.1.1) + actionpack (5.1.4) + actionview (= 5.1.4) + activesupport (= 5.1.4) rack (~> 2.0) - rack-test (~> 0.6.3) + rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.1.1) - activesupport (= 5.1.1) + actionview (5.1.4) + activesupport (= 5.1.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.1.1) - activesupport (= 5.1.1) + activejob (5.1.4) + activesupport (= 5.1.4) globalid (>= 0.3.6) - activemodel (5.1.1) - activesupport (= 5.1.1) - activerecord (5.1.1) - activemodel (= 5.1.1) - activesupport (= 5.1.1) + activemodel (5.1.4) + activesupport (= 5.1.4) + activerecord (5.1.4) + activemodel (= 5.1.4) + activesupport (= 5.1.4) arel (~> 8.0) - activesupport (5.1.1) + activesupport (5.1.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) @@ -41,12 +41,12 @@ GEM arel (8.0.0) ast (2.3.0) bcrypt (3.1.11) - brakeman (3.7.2) + brakeman (4.0.1) builder (3.2.3) - bullet (5.6.1) + bullet (5.7.0) activesupport (>= 3.0.0) uniform_notifier (~> 1.10.0) - cancancan (2.0.0) + cancancan (2.1.2) coffee-rails (4.2.2) coffee-script (>= 2.2.0) railties (>= 4.0.0) @@ -55,6 +55,7 @@ GEM execjs coffee-script-source (1.12.2) concurrent-ruby (1.0.5) + crass (1.0.3) dalli (2.7.6) delayed_job (4.1.3) activesupport (>= 3.0, < 5.2) @@ -67,11 +68,12 @@ GEM railties (>= 4.1.0, < 5.2) responders warden (~> 1.2.3) - erubi (1.6.1) + erubi (1.7.0) execjs (2.7.0) - globalid (0.4.0) + globalid (0.4.1) activesupport (>= 4.2.0) - i18n (0.8.6) + i18n (0.9.1) + concurrent-ruby (~> 1.0) jbuilder (2.7.0) activesupport (>= 4.2.0) multi_json (>= 1.2) @@ -81,42 +83,41 @@ GEM thor (>= 0.14, < 2.0) json (1.8.6) libv8 (3.16.14.19) - loofah (2.0.3) + loofah (2.1.1) + crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.6.6) - mime-types (>= 1.16, < 4) - method_source (0.8.2) - mime-types (3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) - mini_portile2 (2.2.0) + mail (2.7.0) + mini_mime (>= 0.1.1) + method_source (0.9.0) + mini_mime (1.0.0) + mini_portile2 (2.3.0) minitest (5.10.3) multi_json (1.12.2) - mysql2 (0.4.9) - newrelic_rpm (4.4.0.336) + mysql2 (0.4.10) + newrelic_rpm (4.6.0.338) nio4r (2.1.0) - nokogiri (1.8.0) - mini_portile2 (~> 2.2.0) + nokogiri (1.8.1) + mini_portile2 (~> 2.3.0) orm_adapter (0.5.0) parallel (1.12.0) - parser (2.4.0.0) - ast (~> 2.2) + parser (2.4.0.2) + ast (~> 2.3) powerpack (0.1.1) - puma (3.10.0) + puma (3.11.0) rack (2.0.3) - rack-test (0.6.3) - rack (>= 1.0) - rails (5.1.1) - actioncable (= 5.1.1) - actionmailer (= 5.1.1) - actionpack (= 5.1.1) - actionview (= 5.1.1) - activejob (= 5.1.1) - activemodel (= 5.1.1) - activerecord (= 5.1.1) - activesupport (= 5.1.1) - bundler (>= 1.3.0, < 2.0) - railties (= 5.1.1) + rack-test (0.8.2) + rack (>= 1.0, < 3) + rails (5.1.4) + actioncable (= 5.1.4) + actionmailer (= 5.1.4) + actionpack (= 5.1.4) + actionview (= 5.1.4) + activejob (= 5.1.4) + activemodel (= 5.1.4) + activerecord (= 5.1.4) + activesupport (= 5.1.4) + bundler (>= 1.3.0) + railties (= 5.1.4) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) @@ -128,15 +129,15 @@ GEM rails_stdout_logging rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.5) - railties (5.1.1) - actionpack (= 5.1.1) - activesupport (= 5.1.1) + railties (5.1.4) + actionpack (= 5.1.4) + activesupport (= 5.1.4) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.2.2) rake - rake (12.1.0) + rake (12.3.0) rb-readline (0.5.5) rdoc (4.3.0) ref (2.0.0) @@ -144,14 +145,14 @@ GEM actionpack (>= 4.2.0, < 5.3) railties (>= 4.2.0, < 5.3) round_robin_tournament (0.0.1) - rubocop (0.49.1) + rubocop (0.51.0) parallel (~> 1.10) parser (>= 2.3.3.1, < 3.0) powerpack (~> 0.1) - rainbow (>= 1.99.1, < 3.0) + rainbow (>= 2.2.2, < 3.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) - ruby-progressbar (1.8.1) + ruby-progressbar (1.9.0) sdoc (0.4.2) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) @@ -173,9 +174,9 @@ GEM turbolinks (5.0.1) turbolinks-source (~> 5) turbolinks-source (5.0.3) - tzinfo (1.2.3) + tzinfo (1.2.4) thread_safe (~> 0.1) - uglifier (3.2.0) + uglifier (4.0.2) execjs (>= 0.3.0, < 3) unicode-display_width (1.3.0) uniform_notifier (1.10.0) @@ -183,7 +184,7 @@ GEM rack (>= 1.0) websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.2) + websocket-extensions (0.1.3) PLATFORMS ruby @@ -201,7 +202,7 @@ DEPENDENCIES mysql2 newrelic_rpm puma - rails (= 5.1.1) + rails (= 5.1.4) rails_12factor rb-readline round_robin_tournament @@ -214,7 +215,7 @@ DEPENDENCIES uglifier RUBY VERSION - ruby 2.4.0p0 + ruby 2.4.2p198 BUNDLED WITH - 1.15.4 + 1.16.0 diff --git a/rails-dev-Dockerfile b/rails-dev-Dockerfile index dea3cd8..8aa6a7e 100644 --- a/rails-dev-Dockerfile +++ b/rails-dev-Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.4.0 +FROM ruby:2.4.2 RUN apt-get -qq update \ && apt-get -qq install -y \ diff --git a/rails-prod-Dockerfile b/rails-prod-Dockerfile index be0ba22..5937155 100644 --- a/rails-prod-Dockerfile +++ b/rails-prod-Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.4.0 +FROM ruby:2.4.2 RUN apt-get -qq update \ && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y \ From 2ed0d94227caa92227ec4ea787e8bb750e5c1147 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Mon, 11 Dec 2017 08:02:49 -0500 Subject: [PATCH 2/5] Updated to ruby 2.4.2 on travis ci --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5d79363..4962705 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: ruby rvm: -- 2.4.0 +- 2.4.2 env: - DB=sqlite script: From dac040d4f2c27d8f972344a9bc069669a1a93f69 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Wed, 13 Dec 2017 09:02:19 -0500 Subject: [PATCH 3/5] Added example format for tournament date --- app/views/tournaments/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb index 3b0eecc..705506e 100644 --- a/app/views/tournaments/_form.html.erb +++ b/app/views/tournaments/_form.html.erb @@ -28,7 +28,7 @@ <%= f.text_field :director_email %>
- <%= f.label :date %>
+ <%= f.label :date %> (YYYY-MM-DD)
<%= f.date_field :date %>
From 03f3b8dcff88b1d7cf077ad17b549fc57bf48635 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Wed, 13 Dec 2017 11:12:23 -0500 Subject: [PATCH 4/5] Break down wrestlers points on the show page --- app/controllers/wrestlers_controller.rb | 5 +++-- app/views/wrestlers/show.html.erb | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/controllers/wrestlers_controller.rb b/app/controllers/wrestlers_controller.rb index b8526ec..d5390fb 100644 --- a/app/controllers/wrestlers_controller.rb +++ b/app/controllers/wrestlers_controller.rb @@ -3,13 +3,14 @@ class WrestlersController < ApplicationController before_action :check_access, only: [:new,:create,:update,:destroy,:edit,:update_pool] - + # GET /wrestlers/1 # GET /wrestlers/1.json def show @school = @wrestler.school @tournament = @wrestler.tournament + @wrestler_points_calc = CalculateWrestlerTeamScore.new(@wrestler) end # GET /wrestlers/new @@ -104,7 +105,7 @@ class WrestlersController < ApplicationController def set_wrestler @wrestler = Wrestler.where(:id => params[:id]).includes(:school, :weight, :tournament, :matches).first end - + # Never trust parameters from the scary internet, only allow the white list through. def wrestler_params params.require(:wrestler).permit(:name, :school_id, :weight_id, :seed, :original_seed, :season_win, :season_loss,:criteria,:extra,:offical_weight,:pool) diff --git a/app/views/wrestlers/show.html.erb b/app/views/wrestlers/show.html.erb index b71b3b8..67d46e9 100644 --- a/app/views/wrestlers/show.html.erb +++ b/app/views/wrestlers/show.html.erb @@ -33,6 +33,14 @@ Total Team Points Scored: <%= @wrestler.totalTeamPoints %>

+

+ Points Breakdown:
+ Pool Win Points (including BYE points): <%= @wrestler_points_calc.poolPoints %>
+ Bracket Win Points: <%= @wrestler_points_calc.bracketPoints %>
+ Bonus Points: <%= @wrestler_points_calc.bonusWinPoints %>
+ Placement Points:<%= @wrestler_points_calc.placementPoints %>
+

+

From ba055739280471827ac3d43cfda0344353c69bee Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Thu, 14 Dec 2017 09:03:31 -0500 Subject: [PATCH 5/5] Pretty up wrestler show page --- .../calculate_wrestler_team_score.rb | 46 +++++---- app/views/wrestlers/.show.html.erb.swp | Bin 0 -> 12288 bytes app/views/wrestlers/show.html.erb | 95 +++++++++++++----- 3 files changed, 95 insertions(+), 46 deletions(-) create mode 100644 app/views/wrestlers/.show.html.erb.swp diff --git a/app/services/wrestler_services/calculate_wrestler_team_score.rb b/app/services/wrestler_services/calculate_wrestler_team_score.rb index c01db4d..c15267b 100644 --- a/app/services/wrestler_services/calculate_wrestler_team_score.rb +++ b/app/services/wrestler_services/calculate_wrestler_team_score.rb @@ -3,19 +3,19 @@ class CalculateWrestlerTeamScore @wrestler = wrestler @tournament = @wrestler.tournament end - + def totalScore if @wrestler.extra or @wrestler.matches.count == 0 - return 0 + return 0 else earnedPoints - deductedPoints end end - + def earnedPoints - return poolPoints + bracketPoints + placementPoints + bonusWinPoints + return poolPoints + bracketPoints + placementPoints + bonusWinPoints + byePoints end - + def deductedPoints points = 0 @wrestler.deductedPoints.each do |d| @@ -23,29 +23,37 @@ class CalculateWrestlerTeamScore end points end - + def placementPoints PoolBracketPlacementPoints.new(@wrestler).calcPoints if @tournament.tournament_type == "Pool to bracket" end - + def bracketPoints (@wrestler.championshipAdvancementWins.size * 2) + (@wrestler.consoAdvancementWins.size * 1) end - + def poolPoints if @tournament.tournament_type == "Pool to bracket" - if @wrestler.poolWins.size >= 1 and @wrestler.hasAPoolBye == true - ((@wrestler.poolWins.size * 2) + 2) - else - (@wrestler.poolWins.size * 2) - end + (@wrestler.poolWins.size * 2) else - 0 + 0 end end - - def bonusWinPoints - (@wrestler.pinWins.size * 2) + (@wrestler.techWins.size * 1.5) + (@wrestler.majorWins.size * 1) + + def byePoints + if @tournament.tournament_type == "Pool to bracket" + if @wrestler.poolWins.size >= 1 and @wrestler.hasAPoolBye == true + 2 + else + 0 + end + else + 0 + end end - -end \ No newline at end of file + + def bonusWinPoints + (@wrestler.pinWins.size * 2) + (@wrestler.techWins.size * 1.5) + (@wrestler.majorWins.size * 1) + end + +end diff --git a/app/views/wrestlers/.show.html.erb.swp b/app/views/wrestlers/.show.html.erb.swp new file mode 100644 index 0000000000000000000000000000000000000000..49cd3467ac2acacdca802df4cf32414cfd026000 GIT binary patch literal 12288 zcmeI2PiP!f9LHb8f2pY!wNU8gbwf&m$?Rq=7{X?wi%~=(!9o`mYKKN z22+br6%@r5k5v#96ogzv&>ng-Ck3J6K|QKH=|QUp(fEDyXJ`K;n~lVS@)kasoq50c z{rSE(znLXd$vyeVJiSjlLGU?5$ng36so!%`B!8R`-80tY;oUyc&fu%NnUUwEVb$lurGQdEDWDWk3Md7X0!o4ZvjULVg85fiJZ9T_eT9oM-i5P-<+;+$ z&cB`BP0pHmwo6tJX7TY*B59V^ zB9AZ1`nwN@VQDEUkS@dpcH2qCTaPv?f$un_O-DW{BlL>b+G6$)++?Xedagl{A zzPF4>1G(Gl(rjBB;q(T=_uOjx3c(avt_aFHvvo~)g4v6@=kstP68pB9YxT4w?V*A6 zK$pA*^9{PhnL{HVqd96Vqn!xubAz&g@-xC`V} z2Azvcp4yh;Txbo|(&f;yzPbdPXuFo$;u_qj>!N4m2V;|1pT48svvbs%&2;WS&>jUZ zBsTjPx8k|=;H2gD2wRdS$x;}tS#B`yuxCAgTyWhS=R(J{_bGc10ph;WE06fXM7H}W zz#8ur^QpOgj8*eIyGO7E4AWhz+f)CGVqtbV`d@gQ&U=QnY;nJJym_tesg*_kNR zhSzYnYiaV@uSH$B?IO^^#?kEVar>B)-DGyU*-m6b4A0)dNrPKeQ)mu5)9LACIMU@Q z?6BMB6X+(UL35cSJ0t{` zoXw11LfptqFiIb9BsxL z8>iFJy{nk12$zD1nr}JGU&}OO;s&5Ica}~&%w<)M)FSN?gO(&pcxIr;26?pTE3?RC XqXR)U9g7O>O2FXD3{N~^0)+exx|MRU literal 0 HcmV?d00001 diff --git a/app/views/wrestlers/show.html.erb b/app/views/wrestlers/show.html.erb index 67d46e9..ee3ce96 100644 --- a/app/views/wrestlers/show.html.erb +++ b/app/views/wrestlers/show.html.erb @@ -22,37 +22,78 @@ <%= @wrestler.weight.max %>

- Team Points Earned: - <%= @wrestler.teamPointsEarned %> + Extra?: + <%= @wrestler.extra %>

-

- Team Points Deducted: - <%= @wrestler.totalDeductedPoints %> -

-

- Total Team Points Scored: - <%= @wrestler.totalTeamPoints %> -

-

- Points Breakdown:
- Pool Win Points (including BYE points): <%= @wrestler_points_calc.poolPoints %>
- Bracket Win Points: <%= @wrestler_points_calc.bracketPoints %>
- Bonus Points: <%= @wrestler_points_calc.bonusWinPoints %>
- Placement Points:<%= @wrestler_points_calc.placementPoints %>
-

- +
+
+

Point Breakdown

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Point ModifierPoints
Pool Win Points+<%= @wrestler_points_calc.poolPoints %>
BYE Points+<%= @wrestler_points_calc.byePoints %>
Bracket Win Points+<%= @wrestler_points_calc.bracketPoints %>
Bonus Points (pins,major,tech,etc)+<%= @wrestler_points_calc.bonusWinPoints %>
Placement Points+<%= @wrestler_points_calc.placementPoints %>
Deducted Points-<%= @wrestler_points_calc.deductedPoints %>
Total Points Earned<%= @wrestler_points_calc.earnedPoints %>
Total Points Toward Team Score (0 if entered as extra)<%= @wrestler_points_calc.totalScore %>


Matches


- <% @wrestler.allMatches.each do |m| %> -
Bout: <%= m.bout_number %> <%= m.bracket_position %> <%= m.wrestler1.name %> vs. <%= m.wrestler2.name %> <%= @wrestler.resultByBout(m.bout_number) %>
- <% if m.w1_stat || m.w2_stat %> -
Stats:
-
<%= m.list_w1_stats %>
-
<%= m.list_w2_stats %>
-
- <% end %> - <% end %> + + + + + + + + + + + <% @wrestler.allMatches.each do |m| %> + + + + + + <% end %> + +
BoutMatch Bracket PositionStatsResult
<%= m.bout_number %><%= m.bracket_position %><%= m.list_w1_stats %>
<%= m.list_w2_stats %>
<%= @wrestler.resultByBout(m.bout_number) %> +
<% end %>