From bc94c5e941421792e8d36b0975127cab81ffde6c Mon Sep 17 00:00:00 2001 From: Aly Ashour <79553148+alyashour@users.noreply.github.com> Date: Wed, 20 Nov 2024 14:11:20 -0500 Subject: [PATCH] fixed top languages missing bug --- sources/graphics_list_formatter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/graphics_list_formatter.py b/sources/graphics_list_formatter.py index d7c0a28b..0f1452b6 100644 --- a/sources/graphics_list_formatter.py +++ b/sources/graphics_list_formatter.py @@ -70,7 +70,7 @@ def make_list(data: List = None, names: List[str] = None, texts: List[str] = Non percents = [value for item in data for key, value in item.items() if key == "percent"] if percents is None else percents data = list(zip(names, texts, percents)) - top_data = sorted(data[:top_num], key=lambda record: record[2], reverse=True) if sort else data[:top_num] + top_data = sorted(data, key=lambda record: record[2], reverse=True)[:top_num] if sort else data[:top_num] data_list = [f"{n[:25]}{' ' * (25 - len(n))}{t}{' ' * (20 - len(t))}{make_graph(p)} {p:05.2f} % " for n, t, p in top_data] return "\n".join(data_list)