aclu-national / elections-api

An API for retrieving locally-relevant structured data about US elections
https://elections.api.aclu.org/v2/
MIT License
30 stars 4 forks source link

adjust timeframe of term search #56

Closed alisonag closed 3 years ago

alisonag commented 3 years ago

I noticed Sen. Rick Scott wasn't appearing in location searches, and discovered an issue with how we query legislators by term date. In the example below, Sen. Scott is scenario C, because his term started later than most and extends past the end date of the session. Right now we are only returning scenarios B and D. I believe scenario A should still be returned and the front-end can decide whether or not to show legislators who have ended their term early.

Since end dates of a term are equal to start dates of the next term, I wrote the query so that it excludes terms that end on the first day of a session or terms that start on the last day of a session.

Here's a little sketch of different scenarios to cover, where the ones in red (A, B, C, D) are the ones I believe we should return.

IMG_1565

alisonag commented 3 years ago

I didn't realize Koko already had a PR open for this! Closing in favor of #26 , which is more thorough.