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

Method prepaidType

app/models/User.js:916–933  ·  view source on GitHub ↗
(includeCourseIDs)

Source from the content-addressed store, hash-verified

914 }
915
916 prepaidType (includeCourseIDs) {
917 const courseProducts = this.activeProducts('course')
918 if (!courseProducts.length) { return undefined }
919
920 if (_.any(courseProducts, p => (p.productOptions?.includedCourseIDs == null))) { return 'course' }
921 // Note: currently includeCourseIDs is a argument only used when displaying
922 // customized license's course names.
923 // Be careful to match the returned string EXACTLY to avoid comparison issues
924
925 if (includeCourseIDs) {
926 const union = (res, prepaid) => _.union(res, prepaid.productOptions?.includedCourseIDs != null ? prepaid.productOptions?.includedCourseIDs : [])
927 const courses = _.reduce(courseProducts, union, [])
928 // return all courses names join with + as customized licenses's name
929 return (courses.map(id => utils.courseAcronyms[id])).join('+')
930 }
931 // NOTE: Default type is 'course' if no type is marked on the user's copy
932 return 'course'
933 }
934
935 prepaidTypeDescription () {
936 const courseProducts = this.activeProducts('course')

Callers 3

revokeLicensesFunction · 0.80
assignCourseMethod · 0.80
revokeStudentLicensesMethod · 0.80

Calls 1

activeProductsMethod · 0.95

Tested by

no test coverage detected