Skip to content

Commit

Permalink
Merge pull request #160 from ECN/Feature-Sort-queue-counts-by-queue-n…
Browse files Browse the repository at this point in the history
…ame-alphabetically

Feature sort queue counts by queue name alphabetically
  • Loading branch information
benne238 authored Jan 27, 2021
2 parents ebcda1d + f5b4b1e commit 7925d9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ yarn-error.log*
/api/venv
__pycache__/
venv-manager.log
/api/.env
/api/.env
/api/webqueueapi.egg-info
8 changes: 6 additions & 2 deletions api/ECNQueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,11 @@ def getQueueCounts() -> list:
possibleItems = os.listdir(queueDirectory + "/" + queue)
validItems = [isValidItemName for file in possibleItems]
queueInfo.append( {"name": queue, "number_of_items": len(validItems)} )
return queueInfo

# Sorts list of queue info alphabetically
sortedQueueInfo = sorted(queueInfo, key = lambda queueInfoList: queueInfoList['name'])

return sortedQueueInfo


def loadQueues() -> list:
Expand All @@ -1345,4 +1349,4 @@ def loadQueues() -> list:
for queue in getValidQueues():
queues.append(Queue(queue))

return queues
return queues

0 comments on commit 7925d9a

Please sign in to comment.