From 2594c31c4c3c373f59589e50a0b784f468f1baeb Mon Sep 17 00:00:00 2001 From: Hiro Miyamoto Date: Wed, 14 Jun 2023 13:58:53 -0400 Subject: [PATCH] Customizable chart top values (dropdown choices) Signed-off-by: Hiro Miyamoto --- app/controllers/report_controller/reports/editor.rb | 4 ++-- spec/controllers/report_controller_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/report_controller/reports/editor.rb b/app/controllers/report_controller/reports/editor.rb index 7190f582f707..099024e00aaa 100644 --- a/app/controllers/report_controller/reports/editor.rb +++ b/app/controllers/report_controller/reports/editor.rb @@ -9,7 +9,7 @@ module ReportController::Reports::Editor DEFAULT_PDF_PAGE_SIZE = "US-Letter".freeze MAX_REPORT_COLUMNS = 100 # Default maximum number of columns in a report - GRAPH_MAX_COUNT = 10 + GRAPH_MAX_COUNT = ::Settings.reporting.chart_top_values || 10 CHAREGEBACK_ALLOCATED_METHODS = { :max => N_('Maximum'), @@ -653,7 +653,7 @@ def gfv_charts end if params[:chosen_count] && params[:chosen_count] != @edit[:new][:graph_count] - @edit[:new][:graph_count] = params[:chosen_count] + @edit[:new][:graph_count] = params[:chosen_count].to_i @refresh_div = "chart_sample_div" @refresh_partial = "form_chart_sample" end diff --git a/spec/controllers/report_controller_spec.rb b/spec/controllers/report_controller_spec.rb index b2d463960a24..ba3cb482ffae 100644 --- a/spec/controllers/report_controller_spec.rb +++ b/spec/controllers/report_controller_spec.rb @@ -439,7 +439,7 @@ end it "sets top values to show" do - top_val = "3" + top_val = 3 controller.params = {:chosen_count => top_val} controller.send(:gfv_charts) expect(assigns(:edit)[:new][:graph_count]).to eq(top_val)