diff options
Diffstat (limited to 'scripts/statistics.py')
-rw-r--r-- | scripts/statistics.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/statistics.py b/scripts/statistics.py index 927baba..9ec460d 100644 --- a/scripts/statistics.py +++ b/scripts/statistics.py @@ -20,11 +20,19 @@ def collect(d): return (n_admitted, n_theorems, n_qed) +def pick_colour(n, m): + if n > 0.2 * m: return "red" + elif n > 0.1 * m: return "orange" + elif n == 0: return "brightgreen" + else: return "yellow" + + def main(d): - n_admitted, _, _ = collect(d) + n_admitted, n_theorems, _ = collect(d) + colour = pick_colour(n_admitted, n_theorems) url = "https://img.shields.io/badge/Admitted%20Proofs-{}-{}?style=flat".format( - str(n_admitted), "orange") + str(n_admitted), colour) req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"}) with open("admitted.svg", "wb") as f: |