From 6694ed625fd5069de33c7e72558b749c169e0915 Mon Sep 17 00:00:00 2001 From: kingchan Date: Sat, 3 Feb 2024 14:59:43 +0800 Subject: [PATCH] update pie char default --- app/controllers/api/pm/projects_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/api/pm/projects_controller.rb b/app/controllers/api/pm/projects_controller.rb index 64c40d136..a6fc883f6 100644 --- a/app/controllers/api/pm/projects_controller.rb +++ b/app/controllers/api/pm/projects_controller.rb @@ -50,6 +50,12 @@ class Api::Pm::ProjectsController < Api::Pm::BaseController "2": type_status_data[2][1].to_i + type_status_data[2][2].to_i, "3": type_status_data[3][1].to_i + type_status_data[3][2].to_i, } + if type_count_data.keys.size < 3 + nedd_add = [1,2,3] - type_count_data.keys + nedd_add.map{ |e| + type_count_data[e] = 0 + } + end data = { pie_chart: type_count_data, bar_chart: type_status_data,