MCPcopy Index your code
hub / github.com/codecombat/codecombat / getBasicSubscriptionForUser

Method getBasicSubscriptionForUser

app/collections/Products.js:33–47  ·  view source on GitHub ↗
(user)

Source from the content-addressed store, hash-verified

31 getByName (name) { return this.findWhere({ name }) }
32
33 getBasicSubscriptionForUser (user) {
34 let countrySpecificProduct
35 const coupon = __guard__(user != null ? user.get('stripe') : undefined, x => x.couponID)
36 if (coupon) {
37 countrySpecificProduct = this.findWhere({ name: `${coupon}_basic_subscription` })
38 }
39 if (!countrySpecificProduct) {
40 countrySpecificProduct = this.findWhere({ name: 'corrily_basic_subscription' } || this.findWhere({ name: `corrily_${(user != null ? user.get('country') : undefined)}_basic_subscription` }))
41 }
42 if (!countrySpecificProduct) {
43 countrySpecificProduct = this.findWhere({ name: `${(user != null ? user.get('country') : undefined)}_basic_subscription` })
44 }
45 console.log('product selected', countrySpecificProduct)
46 return countrySpecificProduct || this.findWhere({ name: 'basic_subscription' })
47 }
48
49 getBasicAnnualSubscriptionForUser () {
50 const corrilyAnnual = this.findWhere({ name: 'corrily_basic_subscription_annual' })

Callers 3

onLoadedMethod · 0.80
onLoadedMethod · 0.80

Calls 3

logMethod · 0.80
__guard__Function · 0.70
getMethod · 0.45

Tested by

no test coverage detected