in marketing-analytics/activation/sheets-based-installer/src/apps_script/6_sheet/colab_solution_sheet.js [208:244]
updateFunctionStatus_(row, rowIndex) {
const { code, deployedName } = row;
if (!deployedName) {
this.updateCells({ status: 'NOT A FUNCTION' }, rowIndex, 'gray');
return;
}
const properties = getDocumentProperties();
const { projectId, locationId } = properties;
const realName = replaceParameters(deployedName, properties);
const colab = new ColabSolution({ projectId, locationId });
const sourceCode = colab.downloadSourceCode(realName);
const { error } = sourceCode;
if (error) {
if (error.status === 'NOT_FOUND') {
this.updateCells({ status: 'NOT INSTALLED' }, rowIndex, 'orange');
} else {
this.updateCells({ status: `ERROR: ${error.message}` }, rowIndex, 'red');
}
} else {
console.log('old', sourceCode.length)
const newDeployableCode = colab.getDeployableCode(code);
console.log('new', newDeployableCode.length)
const newLines = newDeployableCode.split('\n');
const sourceLines = sourceCode.split('\n');
const equal = newLines.every((line, index) => {
if (sourceLines[index] === line) return true;
console.log('different', line, sourceLines[index]);
return false;
});
console.log(equal)
if (equal && sourceLines.length === newLines.length) {
this.updateCells({ status: 'OK' }, rowIndex, 'green');
} else {
this.updateCells({ status: 'UPDATE available' }, rowIndex, 'orange');
}
}
}