unepwcmc/SAPI — pull request #309 by agnessa (2014-04-30 12:28:04+00:00)
Title: Distribution tags in S+ downloads

1. Adds new fields to taxon concepts mview and the cites / eu / cms mviews that power S+ listings downloads
2. S+ listings downloads are now generated using PG COPY rather than CSV lib
3. Moves the PG COPY logic into a module so that it can be more easily for the Checklist scenario
4. As I was making changes to the taxon concepts mview I noticed some of the old subqueries there can be made faster by simplifying them, so I did that

Note: changes to the CsvCopyExport class affected all the admin downloads in that the query object of those downloads now needs to specify the select clause. The CsvExportable module will match the select clause with a list of passed csv headers.

rake db:migrate
select * from rebuild_taxon_concepts_mview;
select * from rebuild_cites_species_listing_mview();
select * from rebuild_eu_species_listing_mview();
select * from rebuild_cms_species_listing_mview();

Note: I'll handle the Checklist in a separate PR as I just realised we probably should make it "localizable", i.e. we need the distribution columns in the mview in 3 lngs...