Skip to content

Commit

Permalink
clear usertemplate extra snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
haditariq committed Nov 4, 2024
1 parent 598cb87 commit 68e2891
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions app/packs/src/utilities/UserTemplatesHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const onEventListen = async (event) => {
newValue = JSON.parse(newValue);
oldValue = JSON.parse(oldValue);
if (event.key === key) { // matching key && deleteAllowed
// newValue = await sanitizeTemplateAlias(newValue);
if (newValue.length > oldValue.length) { // when a new template is added
let newItem = newValue[newValue.length - 1];
createAddAttachmentidToNewUserTemplate(newValue, newItem);
Expand All @@ -71,32 +70,4 @@ const onEventListen = async (event) => {
}
};


const sanitizeTemplateAlias = async (newValue) => {
for (let i = 0; i < newValue.length; i++) {
let item = newValue[i];
item.struct = JSON.parse(item.struct);
let _struct = item.struct;
const allNodes = Object.keys(_struct);
for (let n = 0; n < allNodes.length; n++) {
const item_mol = allNodes[n];
if (/^mol.*/.test(item_mol)) {
const atoms = _struct[item_mol].atoms;
for (let j = 0; j < atoms.length; j++) {
const atom = atoms[j];
if (three_parts_patten.test(atom.alias)) {
const splits = atom.alias.split("_");
_struct[item_mol].atoms[j].alias = `t_${splits[1]}`;
console.log(_struct[item_mol].atoms[j].alias, "ALIASSSSS");
}
}
}
item.struct = JSON.stringify({ struct: _struct }, null, 4);
newValue[i] = item;
}
}
console.log({ newValue });
return newValue;
};

export default onEventListen;

0 comments on commit 68e2891

Please sign in to comment.