Skip to content

Commit

Permalink
more null spotting
Browse files Browse the repository at this point in the history
  • Loading branch information
waynebruce0x committed Jul 24, 2023
1 parent c55528c commit 8bc5648
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 8 additions & 1 deletion utils/convertToChartData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export function nullFinder(data: any[], key: string) {
nulls = true;
if (key == "postconsolidate" && s.data.unlocked.indexOf(null) != -1)
nulls = true;
if (key == "apiDataMap" && s == null) nulls = true;
if (key == "preforecast" && s.data.unlocked.indexOf(null) != -1)
nulls = true;
if (key == "postPush" && s.data.unlocked.indexOf(null) != -1) nulls = true;
});
if (nulls) {
console.log(`nulls found at ${key}`);
Expand Down Expand Up @@ -81,10 +85,10 @@ export async function createChartData(
});

nullFinder(chartData, "preappend");
// nulls come from the following function
await appendMissingDataSections(chartData, protocol, data);
nullFinder(chartData, "preconsolidate");
const consolidated = consolidateDuplicateKeys(chartData);
nullFinder(chartData, "postconsolidate");
return consolidated;
}
}
Expand Down Expand Up @@ -122,6 +126,7 @@ async function appendMissingDataSections(
);
timestamps = apiDataWithoutForecast.map((d: ApiChartData) => d.timestamp);
unlocked = apiDataWithoutForecast.map((d: ApiChartData) => d.unlocked);
nullFinder(unlocked, "apiDataMap");
if (apiDataWithoutForecast.length > 0 && unlocked.length > 0)
appendOldApiData(
chartData,
Expand All @@ -131,6 +136,7 @@ async function appendMissingDataSections(
timestamps,
);
}
nullFinder(chartData, "preforecast");
appendForecast(chartData, unlocked, i, data);
});
}
Expand Down Expand Up @@ -195,6 +201,7 @@ function appendForecast(
),
section: incompleteSection.key,
});
nullFinder(chartData, "postPush");
}

if (!("notes" in data.metadata)) data.metadata.notes = [];
Expand Down
8 changes: 2 additions & 6 deletions utils/convertToRawData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function createRawSections(
await Promise.all(
Object.entries(a[1]).map(async (b: any[]) => {
if (b[0] == "replaces") return;
await sectionToRaw(documented, b, true);
await sectionToRaw(documented, b);
}),
);
}
Expand All @@ -56,11 +56,7 @@ export async function createRawSections(

await sectionToRaw(rawSections, a);

async function sectionToRaw(
key: RawSection[],
entry: any[],
hi: boolean = false,
) {
async function sectionToRaw(key: RawSection[], entry: any[]) {
const section: string = entry[0];
if (typeof entry[1] === "function") {
entry[1] = entry[1]();
Expand Down

0 comments on commit 8bc5648

Please sign in to comment.