Closed joshdoman closed 6 years ago
This should be done in the penn-sdk-python module as originally opened. The laundry functionality is implemented there.
Would it be better to not change penn-sdk-python
and update the server endpoint to return the requested format? I can see usage cases where having id_to_hall
as a dictionary could be more useful.
@ezwang and I thought it would be more appropriate to do it here since this is purely a tweak in how the response should look. Or do you think that this functionality is core enough that we should add a function in penn-sdk-python to create and cache the array?
@adelq Never mind. We agree, it would be more efficient to cache the array in addition to the old dictionary in penn-sdk-python. Thanks Adel!
To make parsing simpler for Penn Mobile, change the laundry IDs endpoint to an array of objects (hall_name and id) instead of a dictionary of ids to hall_name.
Ex: { "halls": [ { "hall_name": "Bishop White", "id": 0 }, { "hall_name": "Chestnut Butcher", "id": 1 }, continued ] }
The current end point displays:
{ "0": "Bishop White", "1": "Chestnut Butcher", "10": "Harnwell Floor 10", "11": "Harnwell Floor 12", "12": "Harnwell Floor 14", "13": "Harnwell Floor 16", "14": "Harnwell Floor 18", "15": "Harnwell Floor 20", "16": "Harnwell Floor 22", "17": "Harnwell Floor 24", "18": "Harrison Floor 04", "19": "Harrison Floor 06", "2": "Class of 1928 Fisher", "20": "Harrison Floor 08", "21": "Harrison Floor 10", "22": "Harrison Floor 12", "23": "Harrison Floor 14", "24": "Harrison Floor 16", "25": "Harrison Floor 18", "26": "Harrison Floor 20", "27": "Harrison Floor 22", "28": "Harrison Floor 24", "29": "Hill House", "3": "Craig", "30": "Magee Amhurst", "31": "Mayer", "32": "Morgan", "33": "Rodin Floor 02", "34": "Rodin Floor 04", "35": "Rodin Floor 06", "36": "Rodin Floor 08", "37": "Rodin Floor 10", "38": "Rodin Floor 12", "39": "Rodin Floor 14", "4": "DuBois", "40": "Rodin Floor 16", "41": "Rodin Floor 18", "42": "Rodin Floor 20", "43": "Rodin Floor 22", "44": "Rodin Floor 24", "45": "Sansom East", "46": "Sansom West", "47": "Stouffer Commons", "5": "English House", "6": "Harnwell Floor 02", "7": "Harnwell Floor 04", "8": "Harnwell Floor 06", "9": "Harnwell Floor 08" }
Requested by @adelq, @andrewsi10, and @zhileiz