Skip to content

Commit 29c74e1

Browse files
authored
Merge pull request #121 from ReynardoEW/revert-120-categoryChart
revert "add category to api resp"
2 parents e6a51e8 + 753858b commit 29c74e1

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

utils/convertToChartData.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export async function createChartData(
5757
metadata: Metadata;
5858
startTime: number;
5959
endTime: number;
60-
categories?: { [key: string]: string[] };
6160
},
6261
replaces: string[],
6362
): Promise<{ realTimeData: ChartSection[]; documentedData: ChartSection[] }> {
@@ -90,7 +89,7 @@ export async function createChartData(
9089
// nulls come from the following function
9190
await appendMissingDataSections(chartData, protocol, data);
9291
const consolidated = consolidateDuplicateKeys(chartData);
93-
return mapToServerData(consolidated, data.categories);
92+
return consolidated;
9493
}
9594
}
9695
function nullsInApiData(res: any): boolean {
@@ -107,7 +106,6 @@ async function appendMissingDataSections(
107106
metadata: Metadata;
108107
startTime: number;
109108
endTime: number;
110-
categories?: { [key: string]: string[] };
111109
},
112110
) {
113111
const incompleteSections = data.metadata.incompleteSections;
@@ -181,7 +179,6 @@ function appendForecast(
181179
metadata: Metadata;
182180
startTime: number;
183181
endTime: number;
184-
categories?: { [key: string]: string[] };
185182
},
186183
) {
187184
let err: boolean = false;
@@ -403,28 +400,16 @@ function discreet(raw: RawResult, config: ChartConfig): ChartData {
403400
return { timestamps, unlocked, apiData, isContinuous: false };
404401
}
405402

406-
export function mapToServerData(
407-
testData: ChartSection[],
408-
categories?: { [key: string]: string[] }
409-
) {
403+
export function mapToServerData(testData: ChartSection[]) {
410404
const serverData: any[] = testData.map((s: ChartSection) => {
411405
const label = s.section;
412-
let category: string | undefined;
413-
if (categories) {
414-
for (const [cat, sections] of Object.entries(categories)) {
415-
if (sections.includes(label)) {
416-
category = cat;
417-
break;
418-
}
419-
}
420-
}
421406

422407
const data = s.data.timestamps.map((timestamp: number, i: number) => ({
423408
timestamp,
424409
unlocked: s.data.unlocked[i],
425410
}));
426411

427-
return { label, category, data };
412+
return { label, data };
428413
});
429414

430415
return serverData;

0 commit comments

Comments
 (0)