mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
🐛Don't overwrite close.io nces custom field data
This commit is contained in:
parent
652c5237aa
commit
3387e5ee34
1 changed files with 1 additions and 10 deletions
|
@ -506,20 +506,11 @@ class CocoLead {
|
||||||
if (!currentCustom['Lead Origin']) {
|
if (!currentCustom['Lead Origin']) {
|
||||||
putData['custom.Lead Origin'] = this.getLeadOrigin();
|
putData['custom.Lead Origin'] = this.getLeadOrigin();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const email in this.contacts) {
|
for (const email in this.contacts) {
|
||||||
const props = this.contacts[email].trial.properties;
|
const props = this.contacts[email].trial.properties;
|
||||||
if (props) {
|
if (props) {
|
||||||
let haveNcesData = false;
|
|
||||||
for (const prop in props) {
|
for (const prop in props) {
|
||||||
if (/nces_/ig.test(prop)) {
|
if (!currentCustom[`demo_${prop}`] && (commonTrialProperties.indexOf(prop) >= 0 || /nces_/ig.test(prop))) {
|
||||||
haveNcesData = true;
|
|
||||||
putData[`custom.demo_${prop}`] = props[prop];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const prop in props) {
|
|
||||||
// Always overwrite common props if we have NCES data, because other fields more likely to be accurate
|
|
||||||
if (commonTrialProperties.indexOf(prop) >= 0 && (haveNcesData || !currentCustom[`demo_${prop}`] || currentCustom[`demo_${prop}`] !== props[prop] && currentCustom[`demo_${prop}`].indexOf(props[prop]) < 0)) {
|
|
||||||
putData[`custom.demo_${prop}`] = props[prop];
|
putData[`custom.demo_${prop}`] = props[prop];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue