getOrderById returns null for inactive orders
Game.market.getOrderById() is returning null instead of the expected order when the order is inactive. Other functions (extendOrder and cancelOrder) work as expected with same order id.
Thanks for your help.
@starwar15432 hey, what do you mean by 'inactive'? An order with zero remaining amount? An order that is blocked due to its terminal being full? An order tied to a destroyed terminal? Unclaimed room? Please give us more details so we can reproduce and fix the issue. Or, if the order is still in place, please specify its id so we can take a closer look.
Thanks in advance!
Smokeman last edited by Smokeman
I'm having the exact same problem: [11:02:35 AM][shard1]Order 5c27b0b56e6fa00924837c7a returns null
The order is persistent, and only goes active / inactive. It goes inactive when the terminal is full and cannot receive more.
When the terminal becomes available: it turns to: [11:09:34 AM][shard1]Order 5c27b0b56e6fa00924837c7a returns [object Object]
Same order. It was never cancelled. Only difference in active/inactive status.
Edited to add an update about 25 minutes later:
It seems fairly clear that Game.market.get OrderById(id); only looks in the global list filtered by active status. Knowing that the ID I was looking for would always be my own order, I changed it to: Game.market.orders[order_id]; to search only in my orders... which contains all MY orders regardless of active status.
That works fine. It always returns the object as you'd expect. What this means is Game.market.get OrderById(id); is minimally useful as it's ONLY guaranteed to work on active orders. Which... you almost certainly JUST GOT A LIST OF... so you already have all that info.
MrFaul last edited by
How about a rename to
Game.market.isOrderActive(ID)should be much more accurate.
wtfrank last edited by
@mrfaul Are you saying that if we want to retrieve a specific order, we should use a renamed function called Game.market.isOrderActive(OrderId)? Is this an attempt at humour or...
MrFaul last edited by
No what I'm saying is that the function name and result are not accurate associations.
You could also reflect it by changing the result to the correct one.
@o4kapuk So, by 'active' I mean not active by the market my orders page. This has been mainly from remaining amount being 0.
If I extend the order to cause it to become active again the function works as expected.
An example of this is the order
@starwar15432 Thanks, I'll take a look