'get next' steals request that is already assigned
We introduced this bug ourself because we added the assigned
state, and is caused here:
https://eipdev.ewi.tudelft.nl/gitlab/EIP/queue/blob/development/src/main/java/nl/tudelft/ewi/queue/service/RequestService.java#L57
What 'get next' currently does: if there is a request assigned to me, pick that one. else if there is a request that is queued, pick that one.
However, a request is also considered 'queued' when it is assigned to any TA. Therefore, if no request is assigned to you, there is a (high) probability that 'get next' steals a request that was assigned to another TA.
I think we want to replace the queue
variable with a variable pendingRequests
(which contains only requests with the status PENDING), and then change the code to do:
if there is a request assigned to me, pick that one.
else if there is a request in pendingRequests
, pick that one.