From 99da798ac55b6429d38542671b3a856e2ebcf74e Mon Sep 17 00:00:00 2001 From: berliner Date: Thu, 31 Oct 2024 15:49:59 +0100 Subject: [PATCH] HPC-9848: Fix error when creating a baseline for a sparkline chart item if there is no value for any reporting period --- .../src/Plugin/ConfigurationContainerItem/SparkLineChart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/modules/custom/ghi_blocks/src/Plugin/ConfigurationContainerItem/SparkLineChart.php b/html/modules/custom/ghi_blocks/src/Plugin/ConfigurationContainerItem/SparkLineChart.php index 7305de051..f4607f8ea 100644 --- a/html/modules/custom/ghi_blocks/src/Plugin/ConfigurationContainerItem/SparkLineChart.php +++ b/html/modules/custom/ghi_blocks/src/Plugin/ConfigurationContainerItem/SparkLineChart.php @@ -270,7 +270,7 @@ public function getRenderArray() { // Add a baseline if needed. if ($show_baseline) { - $baseline_value = $attachment->getMeasurementMetricValue($baseline, $last_reporting_period->id()); + $baseline_value = $attachment->getMeasurementMetricValue($baseline, $last_reporting_period?->id() ?? 'latest'); } // Render the chart.