MCPcopy Create free account
hub / github.com/codecombat/codecombat / getSponsoredSubsAmount

Function getSponsoredSubsAmount

app/core/utils.js:849–866  ·  view source on GitHub ↗
(price, subCount, personalSub)

Source from the content-addressed store, hash-verified

847}
848
849const getSponsoredSubsAmount = function (price, subCount, personalSub) {
850 // 1 100%
851 // 2-11 80%
852 // 12+ 60%
853 // TODO: make this less confusing
854 if (price == null) { price = 999 }
855 if (subCount == null) { subCount = 0 }
856 if (personalSub == null) { personalSub = false }
857 if (!(subCount > 0)) { return 0 }
858 const offset = personalSub ? 1 : 0
859 if (subCount <= (1 - offset)) {
860 return price
861 } else if (subCount <= (11 - offset)) {
862 return Math.round(((1 - offset) * price) + (((subCount - 1) + offset) * price * 0.8))
863 } else {
864 return Math.round(((1 - offset) * price) + (10 * price * 0.8) + (((subCount - 11) + offset) * price * 0.6))
865 }
866}
867
868const getCourseBundlePrice = function (coursePrices, seats) {
869 let pricePerSeat

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected