1
0
Fork 0

core: TESTING fix for get_machine

This commit is contained in:
Hay1tsme 2023-03-03 15:03:57 -05:00
parent 4c64554383
commit fae6b77403
1 changed files with 13 additions and 2 deletions

View File

@ -50,9 +50,20 @@ arcade_owner = Table(
class ArcadeData(BaseData):
def get_machine(self, serial: str = None, id: int = None) -> Optional[Dict]:
if serial is not None:
sql = machine.select(machine.c.serial == serial)
serial = serial.replace("-", "")
if len(serial) == 11:
sql = machine.select(machine.c.serial.like(f"{serial}%"))
elif len(serial) == 15:
sql = machine.select(machine.c.serial == serial)
else:
self.logger.error(f"{__name__ }: Malformed serial {serial}")
return None
elif id is not None:
sql = machine.select(machine.c.id == id)
else:
self.logger.error(f"{__name__ }: Need either serial or ID to look up!")
return None
@ -110,4 +121,4 @@ class ArcadeData(BaseData):
return result.lastrowid
def generate_keychip_serial(self, platform_id: int) -> str:
pass
pass