Skip to content

Commit

Permalink
#65: remove version fallbacks from the caller
Browse files Browse the repository at this point in the history
these get handled at the function level
  • Loading branch information
mohit-s96 committed May 14, 2024
1 parent 08a647d commit d8d0049
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ const getAdvertisedCountPerResourcesByType = ({ fields, lookups, version = CURRE
return r;
}, Object.create(null));
const advertisedCount = {};
const idxLookups = getIdxLookups(fields, lookups, version ?? CURRENT_DD_VERSION);
const idxLookups = getIdxLookups(fields, lookups, version);
for (const [key, value] of Object.entries(reducedFields)) {
advertisedCount[key] = { fields: {}, lookups: {} };
advertisedCount[key][FIELDS] = { total: 0, reso: 0, idx: 0, local: 0 };
Expand Down Expand Up @@ -264,7 +264,7 @@ const getIdxCounts = (fields, lookups, version = CURRENT_DD_VERSION) => {
/* iDXLookups
lookups of unique IDX fields with any of types ["String List, Single", String List, Multi]
*/
const iDXLookups = getIdxLookups(fields, lookups, version ?? CURRENT_DD_VERSION);
const iDXLookups = getIdxLookups(fields, lookups, version);
const iDXLookupsCount = iDXLookups.length;
return { iDXFieldsCount, iDXResourcesCount, iDXLookupsCount };
};
Expand All @@ -285,7 +285,7 @@ const getFieldsCount = (fields, version = CURRENT_DD_VERSION) => {
const getResourcesCount = (fields, version = CURRENT_DD_VERSION) => {
const resources = [...new Set(fields.map(field => field.resourceName))];
const totalResourcesCount = resources.length;
const standardResourcesCount = resources.filter(resource => getStandardResources(version ?? CURRENT_DD_VERSION).some(x => x === resource)).length;
const standardResourcesCount = resources.filter(resource => getStandardResources(version).some(x => x === resource)).length;
const localResourcesCount = totalResourcesCount - standardResourcesCount;
return { standardResourcesCount, localResourcesCount, totalResourcesCount };
};
Expand Down
8 changes: 4 additions & 4 deletions lib/process-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ const processMetadataReport = (

return {
...transformedMetadataReportJson,
...getFieldsCount(fields, reportInfo.version ?? CURRENT_DD_VERSION),
...getResourcesCount(fields, reportInfo?.version ?? CURRENT_DD_VERSION),
...getFieldsCount(fields, reportInfo.version),
...getResourcesCount(fields, reportInfo?.version),
...getLookupsCount(transformedMetadataReportJson.lookups),
...getIdxCounts(fields, referenceLookups, reportInfo.version ?? CURRENT_DD_VERSION),
...getIdxCounts(fields, referenceLookups, reportInfo.version),
advertised: getAdvertisedCountPerResourcesByType(
transformedMetadataReportJson
),
Expand Down Expand Up @@ -216,7 +216,7 @@ const isReferencePlaceholderValue = ({ lookupValue = '' }) =>
const getTransformedLookups = (metadataReportJson = {}) => {
if (!metadataReportJson?.lookups) return [];

const referenceMetadataJson = getMetadata(metadataReportJson.version ?? CURRENT_DD_VERSION);
const referenceMetadataJson = getMetadata(metadataReportJson.version);
const referenceFieldMap = buildFieldMap(referenceMetadataJson);

//remove placeholder values added to the reference metadata for open enumerations without values
Expand Down

0 comments on commit d8d0049

Please sign in to comment.