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

Method prepaidStatus

app/models/User.js:814–826  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

812 isEnrolled () { return this.prepaidStatus() === 'enrolled' }
813
814 prepaidStatus () { // 'not-enrolled', 'enrolled', 'expired'
815 const courseProducts = _.filter(this.get('products'), { product: 'course' })
816 const now = new Date()
817 const activeCourseProducts = _.filter(courseProducts, p => (new Date(p.endDate) > now) || !p.endDate)
818 const courseIDs = utils.orderedCourseIDs
819 if (!courseProducts.length) { return 'not-enrolled' }
820 if (_.some(activeCourseProducts, function (p) {
821 if (!p.productOptions?.includedCourseIDs?.length) { return true }
822 if (_.intersection(p.productOptions.includedCourseIDs, courseIDs).length) { return true }
823 return false
824 })) { return 'enrolled' }
825 return 'expired'
826 }
827
828 getSeenPromotion (key) {
829 const seenPromotions = this.get('seenPromotions') || {}

Callers 5

isEnrolledMethod · 0.95
constructorMethod · 0.80
studentStatusStringMethod · 0.80
studentStatusStringMethod · 0.80
revokeStudentLicensesMethod · 0.80

Calls 2

getMethod · 0.95
filterMethod · 0.80

Tested by

no test coverage detected