()
| 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') || {} |
no test coverage detected