From 3b9f9bdcc743df0e7af769a332d9badd6c054a03 Mon Sep 17 00:00:00 2001 From: Kayou Date: Sun, 6 Oct 2019 19:02:10 +0200 Subject: [PATCH 1/3] force level if not working --- change_level.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/change_level.py b/change_level.py index 6f3ef108..b18cf814 100755 --- a/change_level.py +++ b/change_level.py @@ -29,6 +29,10 @@ if __name__ == '__main__': if not 0 <= int(level) <= 10: print "Error: app level must be between 0 and 10, it's '%s'" % level sys.exit(1) + + if app_list[app_id]["state"] == "notworking": + print "Warning: app '%s' is currently marked as not working, the level is forced to 0" % app_id + level = 0 app_list[app_id]["level"] = int(level) From fa66e7f629f7a124789fff91ce6ada25026d9841 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 16 Oct 2019 20:14:28 +0900 Subject: [PATCH 2/3] remove level if not working --- change_level.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/change_level.py b/change_level.py index b18cf814..15c46990 100755 --- a/change_level.py +++ b/change_level.py @@ -30,10 +30,10 @@ if __name__ == '__main__': print "Error: app level must be between 0 and 10, it's '%s'" % level sys.exit(1) - if app_list[app_id]["state"] == "notworking": - print "Warning: app '%s' is currently marked as not working, the level is forced to 0" % app_id - level = 0 - - app_list[app_id]["level"] = int(level) + if app_list[app_id]["state"] == "working": + app_list[app_id]["level"] = int(level) + else: + print "Warning: app '%s' is currently not marked as working, the level is removed" % app_id + del app_list[app_id]["level"] open(app_list_name, "w").write("\n".join(json.dumps(app_list, indent=4, sort_keys=True).split(" \n")) + "\n") From 32f6a3b271a496ed88d6b98570ee825d271067c2 Mon Sep 17 00:00:00 2001 From: Kayou Date: Wed, 16 Oct 2019 21:21:49 +0900 Subject: [PATCH 3/3] Update change_level.py Co-Authored-By: Alexandre Aubin --- change_level.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/change_level.py b/change_level.py index 15c46990..51a850bc 100755 --- a/change_level.py +++ b/change_level.py @@ -32,7 +32,7 @@ if __name__ == '__main__': if app_list[app_id]["state"] == "working": app_list[app_id]["level"] = int(level) - else: + elif "level" in app_list[app_id]: print "Warning: app '%s' is currently not marked as working, the level is removed" % app_id del app_list[app_id]["level"]