From 109d0917fbe0acdec99c1e3c1d8510371dfc5f93 Mon Sep 17 00:00:00 2001 From: Alexander Meindl Date: Tue, 26 Nov 2024 09:22:31 +0100 Subject: [PATCH] replace const with var for chart update --- app/models/additionals_chart.rb | 6 ++++-- app/views/additionals/charts/_pie_with_value_table.slim | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/additionals_chart.rb b/app/models/additionals_chart.rb index 4f4a21a6..7599e453 100644 --- a/app/models/additionals_chart.rb +++ b/app/models/additionals_chart.rb @@ -41,8 +41,10 @@ def build_chart_data(datasets, **options) data[:value_link_method] = '_project_issues_path' unless options.key? :value_link_method data[:color_schema] = color_schema - values = Array(datasets).first[:data] - data[:data_sum] = values.present? ? values.sum : 0 + unless options[:skip_data_sum] + values = Array(datasets).first[:data] + data[:data_sum] = values.present? ? values.sum : 0 + end data.merge options end diff --git a/app/views/additionals/charts/_pie_with_value_table.slim b/app/views/additionals/charts/_pie_with_value_table.slim index 14f213fa..9955df5b 100644 --- a/app/views/additionals/charts/_pie_with_value_table.slim +++ b/app/views/additionals/charts/_pie_with_value_table.slim @@ -7,7 +7,7 @@ .clear-both javascript: - const pie_chart_#{{@chart[:id]}} = new Chart(document.getElementById("#{@chart[:id]}"), { + var pie_chart_#{{@chart[:id]}} = new Chart(document.getElementById("#{@chart[:id]}"), { type: 'pie', data: { label_ids: #{raw json_escape(@chart[:label_ids])},