fix #13 - moved increment to end of loop

This commit is contained in:
henry 2025-05-15 19:13:35 -04:00
parent a96a3c3a82
commit ffedc09471
1 changed files with 2 additions and 1 deletions

View File

@ -68,7 +68,7 @@ namespace AccessQueueService.Data
int filledSpots = 0;
while (filledSpots < openSpots && _nowServing < _nextUnusedTicket)
{
if (_accessQueue.TryGetValue(_nowServing++, out var nextUser))
if (_accessQueue.TryGetValue(_nowServing, out var nextUser))
{
_accessQueue.Remove(_nowServing);
_queueNumbers.Remove(nextUser.UserId);
@ -85,6 +85,7 @@ namespace AccessQueueService.Data
};
filledSpots++;
}
_nowServing++;
}
return filledSpots == openSpots;
}