From 8be8048aba7fd201e909b9fbe0fce98b7793da0d Mon Sep 17 00:00:00 2001 From: Heitor Reis Date: Wed, 9 Sep 2015 14:49:28 -0300 Subject: [PATCH] Updated range checking to use kalibro_client implementation --- Gemfile | 2 +- Gemfile.lock | 16 +++++++++++----- app/helpers/processings_helper.rb | 12 +----------- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Gemfile b/Gemfile index ae82b45..544c715 100644 --- a/Gemfile +++ b/Gemfile @@ -28,7 +28,7 @@ gem 'jbuilder', '~> 2.0' gem 'devise', '~> 3.5.1' # Kalibro integration -gem 'kalibro_client', '~> 1.3.0' +gem 'kalibro_client', git: 'https://github.com/mezuro/kalibro_client.git', branch: 'create_kalibro_range_range' # PostgreSQL integration gem "pg", "~> 0.18.1" diff --git a/Gemfile.lock b/Gemfile.lock index 3133835..b22f310 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,12 @@ +GIT + remote: https://github.com/mezuro/kalibro_client.git + revision: 476ed6072156b7be0af0d3f9b61c43aa875bdf86 + branch: create_kalibro_range_range + specs: + kalibro_client (1.3.0) + activesupport (>= 2.2.1) + faraday_middleware (~> 0.10.0) + GEM remote: https://rubygems.org/ specs: @@ -121,7 +130,7 @@ GEM railties (>= 3.0.0) faraday (0.9.1) multipart-post (>= 1.2, < 3) - faraday_middleware (0.9.2) + faraday_middleware (0.10.0) faraday (>= 0.7.4, < 0.10) gherkin (2.12.2) multi_json (~> 1.3) @@ -148,9 +157,6 @@ GEM railties (>= 3.2) sprockets-rails json (1.8.3) - kalibro_client (1.3.0) - activesupport (>= 2.2.1) - faraday_middleware (~> 0.9.0) konacha (3.5.1) actionpack (>= 3.1, < 5) capybara @@ -348,7 +354,7 @@ DEPENDENCIES jquery-rails jquery-ui-rails (~> 5.0.0) js-routes (~> 1.1.0) - kalibro_client (~> 1.3.0) + kalibro_client! konacha less-rails (~> 2.7.0) mocha diff --git a/app/helpers/processings_helper.rb b/app/helpers/processings_helper.rb index 3721dfb..62ac6df 100644 --- a/app/helpers/processings_helper.rb +++ b/app/helpers/processings_helper.rb @@ -9,17 +9,7 @@ module ProcessingsHelper def find_range_snapshot(metric_result) range_snapshots = metric_result.metric_configuration.kalibro_ranges - - range_snapshots.each do |range_snapshot| - range = Range.new( - range_snapshot.beginning == '-INF' ? -Float::INFINITY : range_snapshot.beginning.to_f, - range_snapshot.end == 'INF' ? Float::INFINITY : range_snapshot.end.to_f, - exclude_end: true - ) - return range_snapshot if range === metric_result.value - end - - return nil + range_snapshots.detect { |range_snapshot| range_snapshot.range === metric_result.value } end def format_module_name(module_name) -- libgit2 0.21.2