summaryrefslogtreecommitdiff
path: root/nodejs/automation/selling.ts
diff options
context:
space:
mode:
authorJulien Dessaux2024-03-29 00:24:51 +0100
committerJulien Dessaux2024-03-29 00:24:51 +0100
commit719a9c1a77733040de8e1c4256b92111dcc53c13 (patch)
tree4cc20d3a386507085840b8880ad4350754fbecf2 /nodejs/automation/selling.ts
parent[node] stop trying to optimize useless things like local database calls (diff)
downloadspacetraders-719a9c1a77733040de8e1c4256b92111dcc53c13.tar.gz
spacetraders-719a9c1a77733040de8e1c4256b92111dcc53c13.tar.bz2
spacetraders-719a9c1a77733040de8e1c4256b92111dcc53c13.zip
[node] fixed mining and selling loop issues
Diffstat (limited to 'nodejs/automation/selling.ts')
-rw-r--r--nodejs/automation/selling.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/nodejs/automation/selling.ts b/nodejs/automation/selling.ts
index 987b8ae..04b0e9d 100644
--- a/nodejs/automation/selling.ts
+++ b/nodejs/automation/selling.ts
@@ -19,10 +19,10 @@ export async function sell(ship: Ship, good: string): Promise<Ship> {
// can we sell anything here?
const goods = whatCanBeTradedAt(cargo.goods, market.imports.concat(market.exchange));
for (let i = 0; i < goods.length; i++) {
- const symbol = goods[i].symbol;
- await libShips.sell(ship, good);
+ await libShips.sell(ship, goods[i].symbol);
};
// are we done selling everything we can?
+ ship = dbShips.getShip(ship.symbol);
cargo = utils.categorizeCargo(ship.cargo, good);
if (Object.keys(cargo.goods).length === 0) {
return ship;