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)