From 4c3514af5a1327095880f74e60b7c32bfd542f09 Mon Sep 17 00:00:00 2001 From: Alessandro Maggio Date: Mon, 17 Aug 2020 12:00:32 +0200 Subject: [PATCH] Order the Projects's list by percet key, ref to issue #64 --- .gitignore | 1 + main.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index f64f22c..ea49e9c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules/ __pycache__/ +.vscode diff --git a/main.py b/main.py index d0d18a5..c3d488c 100644 --- a/main.py +++ b/main.py @@ -329,6 +329,8 @@ def get_waka_time_stats(): if len(data['data']['projects']) == 0: project_list = no_activity else: + # Re-order the project list by percentage + data['data']['projects'] = sorted(data['data']['projects'], key=lambda x: x["percent"], reverse=True) project_list = make_list(data['data']['projects']) stats = stats + '🐱‍💻 ' + translate['Projects'] + ': \n' + project_list + '\n\n'