unepwcmc/SAPI — pull request #38 by agnessa (2013-04-11 08:18:39+00:00)
Title: Download eu listings

- huge refactor of current listing calculation scripts to allow for eu listing calculations. Results of the calculations (intermediate and final) are stored in taxon_concepts.listing hstore, with keys prefixed by 'cites' and 'eu' respectively. To do this I had to make changes to existing functionality where older non-prefixed fields were used (e.g. listing_updated_at, closest_listed_ancestor) Having keys consistently prefixed allowed to extract common functionality in most cases to avoid duplication. Explicit listing calculation is duplicated, because it would have to be rewritten completely to make it universal.
- the exports functionality was mostly in place, I just had to amend it to allow for different field names when filtering
- because we don't have the actual eu data in yet, testing can be done on data generated in specs. E.g. run:
bundle exec rspec spec/models/taxon_concept/psittaciformes_spec.rb
and then run the admin tool from the test db, it won't have a lot of taxa but it's possible to test a whole range of cases using the selected examples from specs.