Created
November 25, 2016 18:26
-
-
Save goldhat/8093ad7c6d310baf17b7fcbaa9ccc980 to your computer and use it in GitHub Desktop.
WaitList calcShippableCap() method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Calculate the ShippableCap that represents current maximum shippable units | |
* ShippableCap varies during OrderPeriod | |
* Takes into account potential gain/loss of shippable subscribers | |
* Returns ShippableCap that is compared to current OrderLimit | |
*/ | |
public function calcShippableCap( $orderLimit, $shippableCount ) { | |
$dailyLossRate = 0.0065; | |
$daysRemaining = $this->daysRemainingOrderPeriod(); | |
$periodLossRate = $daysRemaining * $dailyLossRate; | |
$shippableCapPeriod = $this->calcShippableCapPeriod(); | |
switch( $shippableCapPeriod ) { | |
case 10: | |
return floor($orderLimit + ( $shippableCount * $periodLossRate )); | |
break; | |
case 20: | |
return floor($orderLimit + ( $shippableCount * $periodLossRate * 0.5 )); | |
break; | |
case 30: | |
return $orderLimit; | |
break; | |
case 40: | |
return floor( $orderLimit - ($daysRemaining * 25) + 10 ); | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment