Skip to content

Commit

Permalink
Implementation of alphabetical sorting for the getQueueCounts function
Browse files Browse the repository at this point in the history
  • Loading branch information
benne238 committed Jan 5, 2021
1 parent 2bd362c commit d0dc7fe
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
10 changes: 9 additions & 1 deletion 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 queueinfo alphabetically using the lambda function
sortedQueueInfo = sorted(queueInfo, key = lambda queueInfoList: queueInfoList['name'])

return sortedQueueInfo


def loadQueues() -> list:
Expand All @@ -1346,3 +1350,7 @@ def loadQueues() -> list:
queues.append(Queue(queue))

return queues

if __name__ == "__main__":
getQueueCounts()
print()
10 changes: 10 additions & 0 deletions api/webqueueapi.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Metadata-Version: 1.0
Name: webqueueapi
Version: 1.0
Summary: UNKNOWN
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
6 changes: 6 additions & 0 deletions api/webqueueapi.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
api.py
setup.py
webqueueapi.egg-info/PKG-INFO
webqueueapi.egg-info/SOURCES.txt
webqueueapi.egg-info/dependency_links.txt
webqueueapi.egg-info/top_level.txt
1 change: 1 addition & 0 deletions api/webqueueapi.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 2 additions & 0 deletions api/webqueueapi.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ECNqueue
api

0 comments on commit d0dc7fe

Please sign in to comment.