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