hackforla / 311-data

Empowering Neighborhood Associations to improve the analysis of their initiatives using 311 data
https://hackforla.github.io/311-data/
GNU General Public License v3.0
62 stars 63 forks source link

Add logic into data service to handle arrays of IN statments #297

Closed sellnat77 closed 4 years ago

sellnat77 commented 4 years ago

Overview

Multiple IN statements are joined by AND's which means that if there are 2 the query will always resolve to []

Add some smarts in how we generate queries to join multiple IN statements with OR's instead of AND's

sellnat77 commented 4 years ago

@adamkendis @brodly Actually I think this endpoint works as is My POST body is

{
    "startDate":"2019-01-01",
    "endDate":"2019-12-31",
    "ncList": ["SUNLAND-TUJUNGA NC", "HISTORIC HIGHLAND PARK NC"],
    "requestTypes":["Homeless Encampment"]
}

And I get a mixture of both

Unless you disagree...i think this can be closed

brodly commented 4 years ago

I want to make sure this is a FE issue and not backend. Still doing tests and it appears the backend only sends back Sherman Oaks data regardless of what NC you send it.

Your body is formatted differently than what we have. For neighborhood councils, do you expect an array called ncList? We are sending the array as councils. Also we are sending dates formatted as MM/DD/YYYY. What are you expecting?

sellnat77 commented 4 years ago

Ahhhh yeah, you must be getting my defaults then...one sec

sellnat77 commented 4 years ago

https://github.com/hackforla/311-data/blob/445bf8fffd3ea35da08db583362fb1845168403a/server/src/app.py#L105 If the endpoint doesn't get the right params, it's defaulting to Sherman oaks

sellnat77 commented 4 years ago

Confirmed to be working as expected @brodly