From c54dcef205c66d9176883042d06e7f9df1aac9d6 Mon Sep 17 00:00:00 2001 From: Ayush8923 Date: Mon, 26 Aug 2024 00:59:10 +0530 Subject: [PATCH] fix(*): fix the percentage issue --- fill_survey/survey_analysis.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fill_survey/survey_analysis.php b/fill_survey/survey_analysis.php index 929d867abe2..0e724610af5 100644 --- a/fill_survey/survey_analysis.php +++ b/fill_survey/survey_analysis.php @@ -231,7 +231,7 @@ function calculate_pie_chart_data_by_question_category($interpretationdata, $que $pieChartLabels = []; foreach ($interpretationCounts as $interpretation => $count) { - $percentage = (1 / count($interpretationCounts)) * 100; + $percentage = ($count / array_sum($interpretationCounts)) * 100; $pieChartData[] = number_format($percentage, 1); $pieChartLabels[] = $interpretation; }