Skip to content

Commit

Permalink
Merge branch 'master' into 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Lomilar committed Oct 24, 2023
2 parents cc3cf00 + 90581c7 commit 3a9a6ec
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/org/cass/importer/CTDLASNCSVImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ module.exports = class CTDLASNCSVImport {
}
delete pretranslatedE["ceterms:CTID"];
}
// Skip competency if ctid is specified
if (skip && Array.isArray(skip) && skip.length > 0) {
if (skip.find((element) => element.ctid ? element.ctid.includes(pretranslatedE["ceterms:ctid"]) : element === pretranslatedE["ceterms:ctid"])) {
continue;
}
}
if (
pretranslatedE["@type"] ==
"ceasn:CompetencyFramework"
Expand All @@ -164,6 +170,18 @@ module.exports = class CTDLASNCSVImport {
endpoint,
repo
);
for (let each in translator) {
// Make replacements for skipped duplicates
if (skip && Array.isArray(skip) && skip.length > 0) {
skip.forEach((element) => {
if (typeof translator[each] === 'string' && element.ctid && element.replaceWith) {
if (translator[each].contains(element.ctid.replace('ce-', ''))) {
translator[each] = translator[each].replace(element.ctid.replace('ce-', ''), element.replaceWith.replace('ce-', ''));
}
}
});
}
}
for (let each in translator) {
if (terms[each]) {
translator[terms[each]] = translator[each];
Expand Down Expand Up @@ -246,6 +264,16 @@ module.exports = class CTDLASNCSVImport {
frameworkRows[f.shortId()] = e;
f["ceasn:hasChild"] = null;
f["ceasn:hasTopChild"] = null;
// Remove skipped competencies
if (skip && Array.isArray(skip) && skip.length > 0 && f.competency) {
skip.forEach((element) => {
const id = (element.ctid ? element.ctid : element).replace('ce-', '');
const index = f.competency.findIndex((comp) => comp.includes(id));
if (index) {
f.competency.splice(index, 1);
}
});
}
frameworkArray.push(f);
f.competency = [];
f.relation = [];
Expand All @@ -259,6 +287,18 @@ module.exports = class CTDLASNCSVImport {
endpoint,
repo
);
for (let each in translator) {
// Make replacements for skipped duplicates
if (skip && Array.isArray(skip) && skip.length > 0) {
skip.forEach((element) => {
if (typeof translator[each] === 'string' && element.ctid && element.replaceWith) {
if (translator[each].contains(element.ctid.replace('ce-', ''))) {
translator[each] = translator[each].replace(element.ctid.replace('ce-', ''), element.replaceWith.replace('ce-', ''));
}
}
});
}
}
for (let each in translator) {
if (terms[each]) {
translator[terms[each]] = translator[each];
Expand Down

0 comments on commit 3a9a6ec

Please sign in to comment.