Skip to content

Commit

Permalink
Render <0.4 data, accommodating changes over time
Browse files Browse the repository at this point in the history
  • Loading branch information
codemacabre committed Dec 16, 2024
1 parent 7fbe67a commit d5bef34
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/render/renderUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ const getDescription = (description) => {
let identifiersOutput = '';
if (description.identifiers) {
identifiers = description.identifiers.map((identifier, index) => ({
[`Identifier ${index + 1}`]: `(${identifier.schemeName}) ${identifier.id}`,
[`Identifier ${index + 1}`]: `${identifier.scheme ? '(' + identifier.scheme + ') ' : ''}${
identifier.id
}`,
}));
identifiers.forEach((item) => {
const key = Object.keys(item)[0];
Expand Down
12 changes: 12 additions & 0 deletions src/utils/bods.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@ export const filteredData = (statements, selectedDate, version) => {
return [...selectedStatements, ...uniqueFilteredByStatus];
} else {
// get all statements with statementID values in replacesStatements array
const nodeTypes = ['ownershipOrControlStatement', 'entityStatement', 'personStatement'];
const replacedStatements = new Set();

statements.forEach((statement) => {
if (nodeTypes.includes(statement.statementType)) {
(statement.replacesStatements || []).forEach((id) => replacedStatements.add(id));
}
});

return statements.filter((statement) => {
return !(replacedStatements.has(statement.statementID) && nodeTypes.includes(statement.statementType));
});
}
};

Expand Down

0 comments on commit d5bef34

Please sign in to comment.