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

Function noteData

app/views/admin/SkippedContactsView.js:33–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31 },
32 computed: {
33 noteData () {
34 // TODO: Clean this up; it's hastily copied/modified from updateCloseIoLeads.js
35 // TODO: Figure out how to make this less redundant with that script
36 let noteData = ''
37 this.skippedContact
38 if (this.skippedContact.trialRequest != null ? this.skippedContact.trialRequest.properties : undefined) {
39 const props = this.skippedContact.trialRequest.properties
40 if (props.name) {
41 noteData += `${props.name}\n`
42 }
43 if (props.email) {
44 noteData += `demo_email: ${props.email.toLowerCase()}\n`
45 }
46 if (this.skippedContact.trialRequest.created) {
47 noteData += `demo_request: ${this.skippedContact.trialRequest.created}\n`
48 }
49 if (props.educationLevel) {
50 noteData += `demo_educationLevel: ${props.educationLevel.join(', ')}\n`
51 }
52 for (const prop of Array.from(props)) {
53 if (['email', 'educationLevel', 'created'].indexOf(prop) >= 0) { continue }
54 noteData += `demo_${prop}: ${props[prop]}\n`
55 }
56 }
57
58 if (this.user) {
59 noteData += `coco_userID: ${this.user._id}\n`
60 if (this.user.firstName) { noteData += `coco_firstName: ${this.user.firstName}\n` }
61 if (this.user.lastName) { noteData += `coco_lastName: ${this.user.lastName}\n` }
62 if (this.user.name) { noteData += `coco_name: ${this.user.name}\n` }
63 if (this.user.emaillower) { noteData += `coco_email: ${this.user.emailLower}\n` }
64 if (this.user.gender) { noteData += `coco_gender: ${this.user.gender}\n` }
65 if (this.user.lastLevel) { noteData += `coco_lastLevel: ${this.user.lastLevel}\n` }
66 if (this.user.role) { noteData += `coco_role: ${this.user.role}\n` }
67 if (this.user.schoolName) { noteData += `coco_schoolName: ${this.user.schoolName}\n` }
68 if (this.user.stats && this.user.stats.gamesCompleted) { noteData += `coco_gamesCompleted: ${this.user.stats.gamesCompleted}\n` }
69 noteData += `coco_preferredLanguage: ${this.user.preferredLanguage || 'en-US'}\n`
70 }
71 if (this.numClassrooms) { // TODO compute this
72 noteData += `coco_numClassrooms: ${skippedContact.numClassrooms}\n`
73 }
74 if (this.numStudents) { // TODO compute this
75 noteData += `coco_numStudents: ${skippedContact.numStudents}\n`
76 }
77 return noteData
78 },
79
80 // Optional TODO: Reconcile where these kinds of model-y calculations should go (API? the view?)
81 queryString () {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected