959967: calculate installed prods correctly

There was a slight issue where we passed in the lastProcessed entitlement
instead of the current one when comparing validity. This caused us to mark
the previous entitlement invalid, and reset the start date in our
calculations.

I've added two new unit tests to test for the bug as well as comment the
complicated method for future devs.