Skip to content

Commit

Permalink
Check for version >= 0.4 to account for future versions
Browse files Browse the repository at this point in the history
  • Loading branch information
codemacabre committed Aug 27, 2024
1 parent 4f0f70e commit 38d0192
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/model/edges/edges.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const getOwnershipEdges = (bodsData) => {
const version = bodsData[0]?.publicationDetails?.bodsVersion || null;

const filteredData = bodsData.filter((statement) => {
if (version === '0.4') {
if (version >= Number('0.4')) {
return statement.recordType === 'relationship';
} else {
return statement.statementType === 'ownershipOrControlStatement';
Expand Down Expand Up @@ -94,7 +94,7 @@ export const getOwnershipEdges = (bodsData) => {
? directOrIndirect
: 'unknown';
let source, target;
if (version === '0.4') {
if (version >= Number('0.4')) {
source = recordDetails.interestedParty;
target = recordDetails.subject;
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/model/nodes/nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const getPersonNodes = (bodsData) => {
const version = bodsData[0]?.publicationDetails?.bodsVersion || null;

const filteredData = bodsData.filter((statement) => {
if (version === '0.4') {
if (version >= Number('0.4')) {
return statement.recordType === 'person';
} else {
return statement.statementType === 'personStatement';
Expand Down Expand Up @@ -130,7 +130,7 @@ export const getEntityNodes = (bodsData) => {
const version = bodsData[0]?.publicationDetails?.bodsVersion || null;

const filteredData = bodsData.filter((statement) => {
if (version === '0.4') {
if (version >= Number('0.4')) {
return statement.recordType === 'entity';
} else {
return statement.statementType === 'entityStatement';
Expand All @@ -153,7 +153,7 @@ export const getEntityNodes = (bodsData) => {

let countryCode;

if (version === '0.4') {
if (version >= Number('0.4')) {
countryCode = recordDetails.jurisdiction ? sanitise(recordDetails.jurisdiction.code) : null;
} else {
// This gets the country code from v0.2 BODS (incorporatedInJurisdiction)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/bods.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const closedRecords = new Set();

export const latest = (statements, closedRecords, version) => {
if (version === '0.4') {
if (version >= Number('0.4')) {
const statementMap = {};

statements.forEach((statement) => {
Expand Down

0 comments on commit 38d0192

Please sign in to comment.