Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/botPage/view/blockly/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
importFile,
saveBeforeUnload,
removeParam,
updateRenamedFields,
} from './utils';
import Interpreter from '../../bot/Interpreter';
import { createErrorAndEmit } from '../../common/error';
Expand Down Expand Up @@ -75,7 +74,6 @@ const marketsWereRemoved = xml => {
return false;
};
export const loadWorkspace = xml => {
updateRenamedFields(xml);
if (!strategyHasValidTradeTypeCategory(xml)) return;
if (marketsWereRemoved(xml)) return;

Expand All @@ -102,7 +100,6 @@ export const loadWorkspace = xml => {
};

export const loadBlocks = (xml, dropEvent = {}) => {
updateRenamedFields(xml);
if (!strategyHasValidTradeTypeCategory(xml)) return;
if (marketsWereRemoved(xml)) return;

Expand Down
27 changes: 0 additions & 27 deletions src/botPage/view/blockly/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,33 +107,6 @@ export const strategyHasValidTradeTypeCategory = xml => {
return validTradeTypeCategory;
};

export const updateRenamedFields = xml => {
const elementRenames = {
MARKET_LIST: {
volidx: 'synthetic_index',
},
};

const fields = xml.getElementsByTagName('field');

Array.from(fields).forEach(field => {
if (!field.hasAttribute('name')) {
return;
}

Object.keys(elementRenames).forEach(elementRename => {
if (elementRename === field.getAttribute('name')) {
Object.keys(elementRenames[elementRename]).forEach(replacementKey => {
if (replacementKey === field.textContent) {
// eslint-disable-next-line no-param-reassign
field.textContent = elementRenames[elementRename][replacementKey];
}
});
}
});
});
};

const getCollapsedProcedures = () =>
Blockly.mainWorkspace
.getTopBlocks()
Expand Down