Advertisement
Guest User

Untitled

a guest
May 25th, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. '''
  2. 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
  3. going to convert all the 'price' plans in our system into 'ratePerThousand' plans. For Voluntary plans, we need to handle at the
  4. EE level, so this ticket does not address Voluntary plans.
  5. '''
  6. #Please note that the for loops do exactly the same, but I separated it out to explain the reasoning.
  7.  
  8.  
  9. #This script handles all plans with a price but does not have a rate per thousand. For these plans, we're
  10. #going to calculate the new ratePerThousand using the price and the volume. For the multiple plans,
  11. #me and maddie went through the existing multiple plans and we think that the current ones that have a
  12. #price are supposed to actually be 'Stock' plans fortunately.
  13.  
  14.  
  15. lps = LifePlan.objects.all()
  16. for lp in lps:
  17. if not lp.isVoluntary and not lp.supplementalCoverage:
  18. #purely mandatory
  19. if lp.price and not lp.ratePerThousand:
  20. lp.ratePerThousand = lp.price * 1000 / lp.maxAmount
  21. lp.price = None
  22. lp.save()
  23.  
  24. elif not lp.isVoluntary and lp.supplementalCoverage:
  25. #mandatory + supplemental
  26. if lp.price and not lp.ratePerThousand:
  27. lp.ratePerThousand = lp.price * 1000 / lp.maxAmount
  28. lp.price = None
  29. lp.save()
  30.  
  31. #all plans that have a PRICE, along with a rate per thousand, we'll calculate the new rate per thousand using price,
  32. #because in our system, price takes precedence over rate per thousand. Check class EmployeeLifePlan currentCost function
  33.  
  34. lps = LifePlan.objects.all()
  35. for lp in lps:
  36. if not lp.isVoluntary and not lp.supplementalCoverage:
  37. #purely mandatory
  38. if lp.price and lp.ratePerThousand:
  39. lp.ratePerThousand = lp.price * 1000 / lp.maxAmount
  40. lp.price = None
  41. lp.save()
  42.  
  43. elif not lp.isVoluntary and lp.supplementalCoverage:
  44. #mandatory + supplemental
  45. if lp.price and lp.ratePerThousand:
  46. lp.ratePerThousand = lp.price * 1000 / lp.maxAmount
  47. lp.price = None
  48. lp.save()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement