diff --git a/bpeng/pna/pna.py b/bpeng/pna/pna.py index d97df31b442a6bebc18be538f5b632aeb0bcd8bf..c4742113d88200a2be86f5f1f89597210372f6d2 100644 --- a/bpeng/pna/pna.py +++ b/bpeng/pna/pna.py @@ -399,65 +399,23 @@ def calculate_func(building_sq_feet, def calculate_bar_color_number(scores): - num0 = 0 - num1 = 0 - num2 = 0 - num3 = 0 - num_list = [] - - if scores[0][1] in range(0, 2): - num0 = 0 - elif scores[0][1] in range(2, 4): - num0 = 1 - elif scores[0][1] in range(4, 5): - num0 = 2 - elif scores[0][1] in range(5, 6): - num0 = 3 - elif scores[0][1] in range(6, 9): - num0 = 4 - elif scores[0][1] in range(9, 12): - num0 = 5 - - if scores[1][1] in range(0, 3): - num1 = 0 - elif scores[1][1] in range(3, 5): - num1 = 1 - elif scores[1][1] in range(5, 8): - num1 = 2 - elif scores[1][1] in range(8, 9): - num1 = 3 - elif scores[1][1] in range(9, 12): - num1 = 4 - elif scores[1][1] in range(12, 16): - num1 = 5 - - if scores[2][1] in range(0, 2): - num2 = 1 - elif scores[2][1] in range(2, 4): - num2 = 2 - elif scores[2][1] in range(4, 5): - num2 = 3 - elif scores[2][1] in range(5, 8): - num2 = 4 - elif scores[2][1] in range(8, 11): - num2 = 5 - - if scores[3][1] in range(0, 12): - num3 = 0 - elif scores[3][1] in range(12, 18): - num3 = 1 - elif scores[3][1] in range(18, 22): - num3 = 2 - elif scores[3][1] in range(22, 26): - num3 = 3 - elif scores[3][1] in range(26, 31): - num3 = 4 - elif scores[3][1] in range(31, 36): - num3 = 5 - - num_list.append(num0) - num_list.append(num1) - num_list.append(num2) - num_list.append(num3) - - return num_list + # Socre of operations, savings, relavence, financial + data = [0, 0, 1, 0] + + for num in [2, 4, 5, 6, 9, 12]: + if scores[0][1] >= num: + data[0] += 1 + + for num in [3, 5, 8, 9, 12, 16]: + if scores[1][1] >= num: + data[1] += 1 + + for num in [2, 4, 5, 8, 11]: + if scores[2][1] >= num: + data[2] += 1 + + for num in [12, 18, 22, 26, 31, 36]: + if scores[3][1] >= num: + data[3] += 1 + + return data