unepwcmc/SAPI — pull request #82 by agnessa (2013-09-26 16:00:10+00:00)
Title: fix for Natator depressus and a simplification in current listing calculations

OK so it seems that in order to fix one turtle I have rewritten a big chunk of the current listing calculation engine.

The problem was that the turtle was included in family listing at the time the family was listed at II (current inclusion), and unfortunately the current listing calculation would not pick up on the fact that the family was later listed at I. Fixing the existing solution would probably take long and introduce new bugs, so what I did is I decided to merge the cascading legislation and current listing, because the cascading legislation deals with this problem correctly. Previously the current listing calculation consisted of 3 steps:
1. calculate explicit listing for taxon
2. for all taxa with explicit listing, cascade the listing down
3. for all taxa that are non-leaves aggregate descendants listing (in case descendants are listed differently)

At this point steps 1 & 2 are merged and take advantage of the calculated per-designation listing_changes_mviews. That simplifies the calculations, but I also had to change the order in which calculations are run to make sure the mviews are updated before the current listing calculation starts.