pennlabs / labs-api-server

server for search for registrar, etc
MIT License
11 stars 1 forks source link

Trim whitespace from room IDs in Laundry #123

Closed andrewsi10 closed 6 years ago

andrewsi10 commented 6 years ago

The Android app is sending laundry room preferences data to the server as an ArrayList, but the ArrayList toString() method inserts ", " between each element of the ArrayList. As a result, the server is only able to parse the first element and all subsequent elements fail to be parsed because of the whitespace. This should fix the issue while retaining compatibility with the iOS version.

ezwang commented 6 years ago

It looks like the int function automatically ignores white space. Could you give an example of a failing case?

When I run the following, I get the correct output:

[int(x) for x in "1, 2, 3, 4, 5".split(",")]
joshdoman commented 6 years ago

@andrewsi10 Are you asking for us to change the endpoint so that one can query api.pennlabs.org/laundry/preferences?rooms=1, 2 ?

andrewsi10 commented 6 years ago

@joshdoman That's basically what I'm trying to work out. That said, it's clear that the server-side fix I attempted isn't going to resolve the problem so I'll close this PR for now. I'm still investigating the Android side of the code and nothing has worked so far.