From 53d22601ae39de192caedd02dd1c027b97b68a68 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 27 Oct 2017 18:10:28 +0000 Subject: [PATCH] Misc fixes / improvement for appci dashboard --- appci/analyze.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/appci/analyze.py b/appci/analyze.py index 83b491e..46ec57b 100755 --- a/appci/analyze.py +++ b/appci/analyze.py @@ -21,9 +21,10 @@ def main(): data["name"] = app data["statuses"] = [] - if len(appdata.split("\n")) != 2: + if len(appdata.split("\n")) != 2 or len(appdata) != 28: print "Ignoring %s - bad/unavailable data" % app continue + applevel = appdata.split("\n")[1][0] appdata = appdata.split("\n")[0] data["level"] = int(applevel) @@ -40,23 +41,27 @@ def main(): s = "unknown" data["statuses"].append(s) - + data["statusescore"] = statusescore + apps.append(data) apps.sort(key=lambda a: (a["level"], a["statusescore"], a["name"]), reverse=True) - with open("apps.json", "w") as f: - json.dump(apps, f) - - for link in glob.glob("../www/integration/*.svg"): os.unlink(link); + os.symlink("%s/badges/unknown.svg" % os.getcwd(), + "../www/integration/unknown.svg") + for app in apps: - os.symlink("%s/badges/level%s.svg" % (os.getcwd(), app["level"]), + os.symlink("%s/badges/level%s.svg" % (os.getcwd(), app["level"]), "../www/integration/%s.svg" % app["name"]) + with open("apps.json", "w") as f: + json.dump(apps, f) + + main()