From 68357e65ec30dfc271c3c776c8ebf2984e89310d Mon Sep 17 00:00:00 2001 From: rebuilt Date: Thu, 14 Oct 2021 17:33:04 +0200 Subject: [PATCH] Upgrade to rails 5.2. Catch null state in percentage_for method --- Gemfile | 2 +- Gemfile.lock | 92 +++++++++++++++---------------- app/presenters/gauge_presenter.rb | 2 + 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/Gemfile b/Gemfile index 30c68795..dafc369e 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ end # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 5.1.7' +gem 'rails', '~> 5.2.6' gem 'pg' diff --git a/Gemfile.lock b/Gemfile.lock index 54780e0f..ff4076a5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,48 +10,52 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.1.7) - actionpack (= 5.1.7) + actioncable (5.2.6) + actionpack (= 5.2.6) nio4r (~> 2.0) - websocket-driver (~> 0.6.1) - actionmailer (5.1.7) - actionpack (= 5.1.7) - actionview (= 5.1.7) - activejob (= 5.1.7) + websocket-driver (>= 0.6.1) + actionmailer (5.2.6) + actionpack (= 5.2.6) + actionview (= 5.2.6) + activejob (= 5.2.6) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.1.7) - actionview (= 5.1.7) - activesupport (= 5.1.7) - rack (~> 2.0) + actionpack (5.2.6) + actionview (= 5.2.6) + activesupport (= 5.2.6) + rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.1.7) - activesupport (= 5.1.7) + actionview (5.2.6) + activesupport (= 5.2.6) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.1.7) - activesupport (= 5.1.7) + activejob (5.2.6) + activesupport (= 5.2.6) globalid (>= 0.3.6) - activemodel (5.1.7) - activesupport (= 5.1.7) - activerecord (5.1.7) - activemodel (= 5.1.7) - activesupport (= 5.1.7) - arel (~> 8.0) + activemodel (5.2.6) + activesupport (= 5.2.6) + activerecord (5.2.6) + activemodel (= 5.2.6) + activesupport (= 5.2.6) + arel (>= 9.0) activerecord-import (1.2.0) activerecord (>= 3.2) - activesupport (5.1.7) + activestorage (5.2.6) + actionpack (= 5.2.6) + activerecord (= 5.2.6) + marcel (~> 1.0.0) + activesupport (5.2.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) - arel (8.0.0) + arel (9.0.0) autoprefixer-rails (10.3.3.0) execjs (~> 2) bcrypt (3.1.16) @@ -120,19 +124,14 @@ GEM nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) + marcel (1.0.2) method_source (1.0.0) mini_mime (1.1.2) - mini_portile2 (2.6.1) minitest (5.14.4) multi_json (1.15.0) nested_scaffold (1.1.0) newrelic_rpm (8.0.0) nio4r (2.5.8) - nokogiri (1.12.5) - mini_portile2 (~> 2.6.1) - racc (~> 1.4) - nokogiri (1.12.5-x86_64-darwin) - racc (~> 1.4) nokogiri (1.12.5-x86_64-linux) racc (~> 1.4) omniauth (2.0.4) @@ -150,17 +149,18 @@ GEM rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.1.7) - actioncable (= 5.1.7) - actionmailer (= 5.1.7) - actionpack (= 5.1.7) - actionview (= 5.1.7) - activejob (= 5.1.7) - activemodel (= 5.1.7) - activerecord (= 5.1.7) - activesupport (= 5.1.7) + rails (5.2.6) + actioncable (= 5.2.6) + actionmailer (= 5.2.6) + actionpack (= 5.2.6) + actionview (= 5.2.6) + activejob (= 5.2.6) + activemodel (= 5.2.6) + activerecord (= 5.2.6) + activestorage (= 5.2.6) + activesupport (= 5.2.6) bundler (>= 1.3.0) - railties (= 5.1.7) + railties (= 5.2.6) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -171,12 +171,12 @@ GEM nokogiri (>= 1.6) rails-html-sanitizer (1.4.2) loofah (~> 2.3) - railties (5.1.7) - actionpack (= 5.1.7) - activesupport (= 5.1.7) + railties (5.2.6) + actionpack (= 5.2.6) + activesupport (= 5.2.6) method_source rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) + thor (>= 0.19.0, < 2.0) rake (13.0.6) rb-fsevent (0.11.0) rb-inotify (0.10.1) @@ -247,15 +247,13 @@ GEM activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) - websocket-driver (0.6.5) + websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) PLATFORMS - ruby - x86_64-darwin-20 x86_64-linux DEPENDENCIES @@ -278,7 +276,7 @@ DEPENDENCIES omniauth pg puma (~> 3.0) - rails (~> 5.1.7) + rails (~> 5.2.6) rails-controller-testing rspec-rails (~> 4.1.2) sassc-rails diff --git a/app/presenters/gauge_presenter.rb b/app/presenters/gauge_presenter.rb index 96c78135..fd0f6bab 100644 --- a/app/presenters/gauge_presenter.rb +++ b/app/presenters/gauge_presenter.rb @@ -27,8 +27,10 @@ class GaugePresenter end def percentage_for(number) + number ||= 0 scale_minimum = @scale.warning_zone.low_benchmark scale_maximum = @scale.ideal_zone.high_benchmark + (number - scale_minimum) / (scale_maximum - scale_minimum) end end