[caciviclab/disclosure-backend-static] Filter all queries to the highest Report_Num value (#22)

0 views
Skip to first unread message

Tom Dooner

unread,
Sep 17, 2016, 11:25:33 PM9/17/16
to caciviclab/disclosure-backend-static

This [Fixes #21] by using a postgres-specific "DISTINCT ON" clause to
return only the first distinct row for a set of columns matching the
previous GROUP BY column set. The new GROUP BY includes "Report_Num"
column. To ensure deterministic behavior, we also must add an ORDER BY
clause like:

ORDER BY [...distinct on columns...], "Report_Num" DESC

See http://stackoverflow.com/a/13327987/910723 for more details.

I manually audited the two affected organizations -- Just Cause and the
Committee to Protect Oakland Renters -- to verify that the new totals
match the most recent report figures only.


You can view, comment on, or merge this pull request online at:

  https://github.com/caciviclab/disclosure-backend-static/pull/22

Commit Summary

  • Filter all queries to the highest Report_Num value

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

Reply all
Reply to author
Forward
0 new messages