Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- I talked to Kelli and Caitlin, and they said that in the real world Life plans do not ever have a fixed price / EE. Therefore we're
- going to convert all the 'price' plans in our system into 'ratePerThousand' plans. For Voluntary plans, we need to handle at the
- EE level, so this ticket does not address Voluntary plans.
- '''
- #Please note that the for loops do exactly the same, but I separated it out to explain the reasoning.
- #This script handles all plans with a price but does not have a rate per thousand. For these plans, we're
- #going to calculate the new ratePerThousand using the price and the volume. For the multiple plans,
- #me and maddie went through the existing multiple plans and we think that the current ones that have a
- #price are supposed to actually be 'Stock' plans fortunately.
- lps = LifePlan.objects.all()
- for lp in lps:
- if not lp.isVoluntary and not lp.supplementalCoverage:
- #purely mandatory
- if lp.price and not lp.ratePerThousand:
- lp.ratePerThousand = lp.price * 1000 / lp.maxAmount
- lp.price = None
- lp.save()
- elif not lp.isVoluntary and lp.supplementalCoverage:
- #mandatory + supplemental
- if lp.price and not lp.ratePerThousand:
- lp.ratePerThousand = lp.price * 1000 / lp.maxAmount
- lp.price = None
- lp.save()
- #all plans that have a PRICE, along with a rate per thousand, we'll calculate the new rate per thousand using price,
- #because in our system, price takes precedence over rate per thousand. Check class EmployeeLifePlan currentCost function
- lps = LifePlan.objects.all()
- for lp in lps:
- if not lp.isVoluntary and not lp.supplementalCoverage:
- #purely mandatory
- if lp.price and lp.ratePerThousand:
- lp.ratePerThousand = lp.price * 1000 / lp.maxAmount
- lp.price = None
- lp.save()
- elif not lp.isVoluntary and lp.supplementalCoverage:
- #mandatory + supplemental
- if lp.price and lp.ratePerThousand:
- lp.ratePerThousand = lp.price * 1000 / lp.maxAmount
- lp.price = None
- lp.save()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement