There is a method in the tariff.ts file called isTariffRateTiered that takes a TariffRate and tells the caller if its tiered or not. This issue is to add a new helpers similar to this, but to tell the caller if the rate has a rate factor. Call the method isTariffRateWithFactor.
This returns true if either a) the tariff rate has a value in the variableFactorKey populated, or if not if one of its tariff rate bands has a calculationFactor populated.
Unit tests:
1) no variableFactorKey populated and no calculationFactor on any rate band. Returns false.
2) yes variableFactorKey populated but no calculationFactor on any rate band. Returns true.
3) no variableFactorKey populated but one of its tariff rate bands with a calculationFactor. Returns true.
There is a method in the
tariff.ts
file calledisTariffRateTiered
that takes aTariffRate
and tells the caller if its tiered or not. This issue is to add a new helpers similar to this, but to tell the caller if the rate has a rate factor. Call the methodisTariffRateWithFactor
.This returns true if either a) the tariff rate has a value in the
variableFactorKey
populated, or if not if one of its tariff rate bands has acalculationFactor
populated.Unit tests: 1) no
variableFactorKey
populated and nocalculationFactor
on any rate band. Returns false. 2) yesvariableFactorKey
populated but nocalculationFactor
on any rate band. Returns true. 3) novariableFactorKey
populated but one of its tariff rate bands with acalculationFactor
. Returns true.