forked from Hay1tsme/artemis
core: TESTING fix for get_machine
This commit is contained in:
parent
4c64554383
commit
fae6b77403
@ -50,9 +50,20 @@ arcade_owner = Table(
|
|||||||
class ArcadeData(BaseData):
|
class ArcadeData(BaseData):
|
||||||
def get_machine(self, serial: str = None, id: int = None) -> Optional[Dict]:
|
def get_machine(self, serial: str = None, id: int = None) -> Optional[Dict]:
|
||||||
if serial is not None:
|
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:
|
elif id is not None:
|
||||||
sql = machine.select(machine.c.id == id)
|
sql = machine.select(machine.c.id == id)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.logger.error(f"{__name__ }: Need either serial or ID to look up!")
|
self.logger.error(f"{__name__ }: Need either serial or ID to look up!")
|
||||||
return None
|
return None
|
||||||
@ -110,4 +121,4 @@ class ArcadeData(BaseData):
|
|||||||
return result.lastrowid
|
return result.lastrowid
|
||||||
|
|
||||||
def generate_keychip_serial(self, platform_id: int) -> str:
|
def generate_keychip_serial(self, platform_id: int) -> str:
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user