Closed trz-maier closed 5 years ago
This is now kind of fixed but random orders get added and pushed to the end of the queue - is this expected behaviour or another bug?
Because of the sorting implemented for Order objects, they are placed in the queue depending on two criterias
In sort, this works as expected and it was a choice taken during the implementation, though could be easily changed if desired.
I don't think I am understood. I am talking about orders of the same priority not being sorted by the time they are added when both randomly generated orders and orders from file are simultaneously added to the queues. Like I said in my previous comment randomly generated orders seems to be pushed to the end of the queue regardles of whether they are added before or after orders from the file
we can use the Date timestamp to sort. Instead of adding the timestamp, as soon as the order is taken by the server, we can add a timestamp -as previously - when we create the order
Can we not set a date or counter of Order being added to the queue as opposed to object being created? This sounds like a simple solution. Just create a setCounter method for the Order and have the OrderQueue call it when adding
a function like setCounter would work, but would be a bit hacky, since you can not guarantee that you always set the counter. Using the timestamp again when the object is created(as in CW1) should be fine, since the date is mandatory. But the cw requirements don't tell us that we have to set the date when the server finishes the order. But i am fine with both Solutions.
moved to #160
If you try adding random orders right after program starts you can see that no further orders from the file are being added