From: Roland Häder Date: Wed, 28 Jun 2023 11:32:14 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=eade656a4a9c5c46353081d5be6bde24f51fb3a9;p=fba.git Continued: - /api/info.json doesn't need to return slogan while it can be taken directly from configuration - exclude empty origins, not software --- diff --git a/api.py b/api.py index 9b8276c..282b681 100644 --- a/api.py +++ b/api.py @@ -59,7 +59,6 @@ def api_info(): "supported_instances": row[1], "blocks_recorded" : row[2], "erroneous_instances": row[3], - "slogan" : config.get("slogan"), } @router.get(config.get("base_url") + "/api/scoreboard.json", response_class=JSONResponse) @@ -72,7 +71,7 @@ def api_scoreboard(mode: str, amount: int): elif mode == "blocker": database.cursor.execute("SELECT blocker, COUNT(blocker) AS score FROM blocks GROUP BY blocker ORDER BY score DESC LIMIT ?", [amount]) elif mode == "reference": - database.cursor.execute("SELECT origin, COUNT(domain) AS score FROM instances WHERE software IS NOT NULL GROUP BY origin ORDER BY score DESC LIMIT ?", [amount]) + database.cursor.execute("SELECT origin, COUNT(domain) AS score FROM instances WHERE origin IS NOT NULL GROUP BY origin ORDER BY score DESC LIMIT ?", [amount]) elif mode == "software": database.cursor.execute("SELECT software, COUNT(domain) AS score FROM instances WHERE software IS NOT NULL GROUP BY software ORDER BY score DESC, software ASC LIMIT ?", [amount]) elif mode == "command": @@ -267,7 +266,8 @@ def index(request: Request): return templates.TemplateResponse("views/index.html", { "request": request, "theme" : config.get("theme"), - "info" : response.json() + "info" : response.json(), + "slogan" : config.get("slogan"), }) @router.get(config.get("base_url") + "/top") diff --git a/templates/base.html b/templates/base.html index 809dd3a..7191ba4 100644 --- a/templates/base.html +++ b/templates/base.html @@ -24,9 +24,7 @@ {% block footer %} Source code: git.mxchange.org

- {% if info %} - {{info.slogan}} - {% elif slogan %} + {% if slogan %} {{slogan}} {% else %} No slogan was found!