From 1b7e15e4b7d13a4d3c476d2d9fcb306ade98a080 Mon Sep 17 00:00:00 2001 From: 13507605001 Date: Fri, 25 Nov 2022 10:01:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0=E6=95=B0=E6=8D=AE=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db_logic/medicament_record.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/db_logic/medicament_record.py b/db_logic/medicament_record.py index 8747a0a..ef185b6 100644 --- a/db_logic/medicament_record.py +++ b/db_logic/medicament_record.py @@ -312,10 +312,18 @@ class BllMedicamentRecord(Repository): for i in data_li: if i["count_num"] is None: i["count_num"] = 0 + if data_number == 0: + ratio = "0%" + else: + ratio = Utils.classify(i["count_num"], data_number) new_dic = { - "ratio": Utils.classify(i["count_num"], data_number) + "ratio": ratio + } - i["count_num"] = int(i["count_num"]) + if i["count_num"] == 0: + i["count_num"] = '' + else: + i["count_num"] = int(i["count_num"]) new_dic.update(**i) data_list.append(new_dic) return data_list