Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
affiliate
+ referrals
| + referral
| | + player
| | | + rake
| | | + rake
| | + player
| | + rake
| + referral
| | + player
| | | + rake
| + referral
| + player
| + rake
| + rake
| + rake
|
+ payscale
+ tier
| +min # 0
| +max # 1000
| +rate # 3%
+ tier
| +min # 1000
| +max # 2500
| +rate # 4%
+ tier
+min # 2500
+max # null
+rate # 5%
# current way of doing things
1. When stats are uploaded, we check for affiliate exception rates
If no exception rate is found, we use 0%
user player referred_by rake referral_rate commission
A X foo $50 1% $0.50 # exception found for X-type player
A Y foo $100 0% $0.00
A Z foo $0 0% $0.00
2. After exceptions are accounted for, we want to use the payscale for the remaining 0% rates
Sum rakes that have a 0% and check the payscale to see what rate they should get
$50 @ 1% gets rolled into sum for tier determination, but stays locked at 1%
$100 @ 0% gets rolled into sum
$0 @ 0% gets rolled into sum
---------------------------------
$150 = total rake
If the payscale is:
0-100 => 3%
100-250 => 4%
250+ => 5%
Then a sum of $150 (50 + 100 + 0) referred rake would get 4%.
3. Update the 0% rates to 4% and calculate the commission column. Final table looks like
user player referred_by rake referral_rate commission
A X foo $50 1% $0.50
A Y foo $100 4% $4.00
A Z foo $0 4% $0.00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.