From 0a56207e90149f7cf7ae7a73c088f1a4c07eb02e Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Tue, 9 Jan 2024 20:08:10 -0500 Subject: [PATCH] frontend: fix cab list on arcade page --- core/frontend.py | 18 ++++++++++++------ core/templates/arcade/index.jinja | 15 +++++++++++++++ core/templates/machine/index.jinja | 1 - 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/core/frontend.py b/core/frontend.py index caf5c74..17b058f 100644 --- a/core/frontend.py +++ b/core/frontend.py @@ -677,24 +677,30 @@ class FE_Arcade(FE_Base): sesh=vars(usr_sesh), )) - try: - sinfo = await self.data.arcade.get_arcade(shop_id) - except Exception as e: - self.logger.error(f"Failed to fetch shop info for shop {shop_id} in render_GET - {e}") - sinfo = None + sinfo = await self.data.arcade.get_arcade(shop_id) if not sinfo: return Response(template.render( title=f"{self.core_config.server.name} | Arcade", sesh=vars(usr_sesh), )) + cabs = await self.data.arcade.get_arcade_machines(shop_id) + cablst = [] + if cabs: + for x in cabs: + cablst.append({ + "id": x['id'], + "serial": x['serial'], + "game": x['game'], + }) + return Response(template.render( title=f"{self.core_config.server.name} | Arcade", sesh=vars(usr_sesh), arcade={ "name": sinfo['name'], "id": sinfo['id'], - "cabs": [] + "cabs": cablst } )) diff --git a/core/templates/arcade/index.jinja b/core/templates/arcade/index.jinja index 627f203..1de4301 100644 --- a/core/templates/arcade/index.jinja +++ b/core/templates/arcade/index.jinja @@ -1,4 +1,19 @@ {% extends "core/templates/index.jinja" %} {% block content %} +{% if arcade is defined %}

{{ arcade.name }}

+

PCBs assigned to this arcade

+{% if success is defined and success == 3 %} +
+Cab added successfully +
+{% endif %} + +{% else %} +

Arcade Not Found

+{% endif %} {% endblock content %} \ No newline at end of file diff --git a/core/templates/machine/index.jinja b/core/templates/machine/index.jinja index 38a40a7..3e122f3 100644 --- a/core/templates/machine/index.jinja +++ b/core/templates/machine/index.jinja @@ -1,5 +1,4 @@ {% extends "core/templates/index.jinja" %} {% block content %} -{% include "core/templates/widgets/err_banner.jinja" %}

Machine Management

{% endblock content %} \ No newline at end of file