Skip to content

Commit

Permalink
fixed issue with ship singleton manager not always returning the righ…
Browse files Browse the repository at this point in the history
…t ship
  • Loading branch information
Ctri-The-Third committed Apr 11, 2024
1 parent 2df8671 commit 97d7f88
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions straders_sdk/client_mediator.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ def ships_view(self, force=False) -> dict[str, Ship] or SpaceTradersResponse:
if resp:
self.ships = self.ships | resp
for ship in self.ships.values():

ship = SingletonShips().add_ship(ship)

return resp
start = datetime.now()
resp = self.api_client.ships_view()
Expand Down Expand Up @@ -258,8 +258,7 @@ def ships_view_one(self, symbol: str, force=False):
resp = self.db_client.ships_view_one(symbol)
if resp:
resp: Ship
SingletonShips().add_ship(resp)

resp = SingletonShips().add_ship(resp)

return resp
start = datetime.now()
Expand All @@ -270,7 +269,7 @@ def ships_view_one(self, symbol: str, force=False):
if resp:
resp: Ship
resp.dirty = True
SingletonShips().add_ship(resp)
resp = SingletonShips().add_ship(resp)

self.db_client.update(resp)
return resp
Expand All @@ -289,7 +288,7 @@ def ships_purchase(
self.set_connections()
start = datetime.now()
resp = self.api_client.ships_purchase(ship_type, waypoint)
resp[0] = SingletonShips().add_ship(resp[0])
resp = (SingletonShips().add_ship(resp[0]), resp[1])
self.logging_client.ships_purchase(
ship_type, waypoint, resp, (datetime.now() - start).total_seconds()
)
Expand Down

0 comments on commit 97d7f88

Please sign in to comment.