From 524677d6bdb4b9810583c7f2fe8b20de0d070ffe Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Sun, 4 Dec 2011 22:44:17 +0100 Subject: Fix drilldown page in order to accept the parameter period=0 --- .../main/webapp/WEB-INF/app/controllers/drilldown_controller.rb | 8 ++++---- .../main/webapp/WEB-INF/app/models/api/dashboard_configuration.rb | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb index ca66a93d92d..b35c5378c16 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb @@ -70,12 +70,12 @@ class DrilldownController < ApplicationController @rule=Rule.by_key_or_id(params[:rule]) # variation measures - if params[:period].blank? - @period=nil - metric_prefix = '' - else + if params[:period].present? && params[:period].to_i>0 @period=params[:period].to_i metric_prefix = 'new_' + else + @period=nil + metric_prefix = '' end @severity = params[:severity] || params[:priority] diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/api/dashboard_configuration.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/api/dashboard_configuration.rb index 3ae393f9d9e..372a44bd4de 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/api/dashboard_configuration.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/api/dashboard_configuration.rb @@ -23,8 +23,8 @@ class Api::DashboardConfiguration def initialize(dashboard, options={}) @dashboard=dashboard - @period_index=options[:period_index].to_i - @selected_period=(@period_index>0) + @period_index=(options[:period_index].to_i>0 ? options[:period_index].to_i : nil) + @selected_period=(@period_index != nil) @snapshot=options[:snapshot] end -- cgit v1.2.3