project-open-data/csv-to-api

Filter parameter doesn't work

waldoj opened this issue · 4 comments

Passing a field as a key/value pair to filter by doesn't do anything. Somewhere it's failing—we've got to figure out where.

I'm puzzled. list_filter is working great—it's outputting just those elements that match. query, which runs list_filter, also returns the correct data. And parse, from within which query is run, is also returning the correct data. But then, in output, $this->data returns all records, not only those that have been included via the filter. What's going on here? @benbalter, do you have any idea?

The problem was that parse was returning the filtered data, but output was pulling from $this->data. Since we're creating and destroying the object on each request, there's no reason we can't rewrite data with the filtered query (but keeping the cache untouched).

Make sense!

Er...that should say "makes sense." Funny how dropping a single letter can change dramatically the meaning of a two-word phrase!