Skip to content

Commit dbcb7f0

Browse files
committed
fix formatting issues
1 parent b85a142 commit dbcb7f0

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

frontend/src/Components/Elements/Table/TableModal.js

+19-17
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ function TableModal({ chartState, dataSet, columns, isOpen, closeModal }) {
268268
tableData = mergedData.sort((a, b) =>
269269
// Sort data descending by year
270270
// eslint-disable-next-line no-nested-ternary
271-
a['year'] < b['year'] ? 1 : b['year'] < a['year'] ? -1 : 0
271+
a['year'] < b['year'] ? 1 : b['year'] < a['year'] ? -1 : 0,
272272
);
273273
}
274274
return [raceTotals, ...tableData];
@@ -318,7 +318,7 @@ function TableModal({ chartState, dataSet, columns, isOpen, closeModal }) {
318318
tableData = mergedData.sort((a, b) =>
319319
// Sort data descending by year
320320
// eslint-disable-next-line no-nested-ternary
321-
a['year'] < b['year'] ? 1 : b['year'] < a['year'] ? -1 : 0
321+
a['year'] < b['year'] ? 1 : b['year'] < a['year'] ? -1 : 0,
322322
);
323323
}
324324
return [raceTotals, ...tableData];
@@ -359,7 +359,7 @@ function TableModal({ chartState, dataSet, columns, isOpen, closeModal }) {
359359
tableData = mergedData.sort((a, b) =>
360360
// Sort data descending by year
361361
// eslint-disable-next-line no-nested-ternary
362-
a['year'] < b['year'] ? 1 : b['year'] < a['year'] ? -1 : 0
362+
a['year'] < b['year'] ? 1 : b['year'] < a['year'] ? -1 : 0,
363363
);
364364
}
365365
return [raceTotals, ...tableData];
@@ -392,7 +392,7 @@ function TableModal({ chartState, dataSet, columns, isOpen, closeModal }) {
392392
tableData = mappedData.sort((a, b) =>
393393
// Sort data descending by year
394394
// eslint-disable-next-line no-nested-ternary
395-
a['year'] < b['year'] ? 1 : b['year'] < a['year'] ? -1 : 0
395+
a['year'] < b['year'] ? 1 : b['year'] < a['year'] ? -1 : 0,
396396
);
397397
}
398398
return [raceTotals, ...tableData];
@@ -424,7 +424,7 @@ function TableModal({ chartState, dataSet, columns, isOpen, closeModal }) {
424424
tableData = mappedData.sort((a, b) =>
425425
// Sort data descending by year
426426
// eslint-disable-next-line no-nested-ternary
427-
a['year'] < b['year'] ? 1 : b['year'] < a['year'] ? -1 : 0
427+
a['year'] < b['year'] ? 1 : b['year'] < a['year'] ? -1 : 0,
428428
);
429429
}
430430
return [raceTotals, ...tableData];
@@ -445,18 +445,20 @@ function TableModal({ chartState, dataSet, columns, isOpen, closeModal }) {
445445
data = mapSearchesByReason(ds);
446446
} else if (ds === LIKELIHOOD_OF_STOP) {
447447
chartData = tableChartState.data[ds].table_data;
448-
// Define keys that should be converted to percentages
449-
chartData = chartData.map((chartDatum) => {
450-
const formattedDatum = { ...chartDatum };
451-
452-
Object.keys(formattedDatum).forEach((key) => {
453-
if (["baseline_rate", "stop_rate", "stop_rate_ratio", "population_percent"].includes(key) &&
454-
typeof formattedDatum[key] === "number") {
455-
formattedDatum[key] = parseFloat((formattedDatum[key] * 100).toFixed(2)); // Convert to percentage
448+
// Define keys that should be converted to percentages
449+
chartData = chartData.map((chartDatum) => {
450+
const formattedDatum = { ...chartDatum };
451+
452+
Object.keys(formattedDatum).forEach((key) => {
453+
if (
454+
['baseline_rate', 'stop_rate', 'stop_rate_ratio', 'population_percent'].includes(key) &&
455+
typeof formattedDatum[key] === 'number'
456+
) {
457+
formattedDatum[key] = parseFloat((formattedDatum[key] * 100).toFixed(2)); // Convert to percentage
456458
}
459+
});
460+
return formattedDatum;
457461
});
458-
return formattedDatum;
459-
});
460462
// eslint-disable-next-line no-param-reassign,no-return-assign
461463
chartData.forEach((chartDatum) => (chartDatum['total'] = calculateYearTotal(chartDatum)));
462464
return chartData;
@@ -480,7 +482,7 @@ function TableModal({ chartState, dataSet, columns, isOpen, closeModal }) {
480482
tableData = chartData.sort((a, b) =>
481483
// Sort data descending by year
482484
// eslint-disable-next-line no-nested-ternary
483-
a['year'] < b['year'] ? 1 : b['year'] < a['year'] ? -1 : 0
485+
a['year'] < b['year'] ? 1 : b['year'] < a['year'] ? -1 : 0,
484486
);
485487
}
486488
data = [raceTotals, ...tableData];
@@ -736,7 +738,7 @@ function TableModal({ chartState, dataSet, columns, isOpen, closeModal }) {
736738
</S.TableModal>
737739
</>
738740
),
739-
portalTarget
741+
portalTarget,
740742
);
741743
}
742744

0 commit comments

Comments
 (0)