mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 14:45:24 +02:00
Improve date column detection in Missing Data filters
This commit is contained in:
@@ -77,10 +77,16 @@ export function MissingDataView({ data, headers, onSaveRow, onCaptureState }: Mi
|
|||||||
const [openFilter, setOpenFilter] = useState<number | null>(null);
|
const [openFilter, setOpenFilter] = useState<number | null>(null);
|
||||||
const pageSize = 100;
|
const pageSize = 100;
|
||||||
|
|
||||||
const launchDateCol = useMemo(() =>
|
const launchDateCol = useMemo(() => {
|
||||||
headers.findIndex(h => h.toLowerCase().includes('launch')), [headers]);
|
const idx = headers.findIndex(h => h.toLowerCase().includes('launch'));
|
||||||
const readyToOrderCol = useMemo(() =>
|
if (idx >= 0) return idx;
|
||||||
headers.findIndex(h => h.toLowerCase().includes('ready')), [headers]);
|
return headers.findIndex(h => h.toLowerCase().includes('date'));
|
||||||
|
}, [headers]);
|
||||||
|
const readyToOrderCol = useMemo(() => {
|
||||||
|
const idx = headers.findIndex(h => h.toLowerCase().includes('ready'));
|
||||||
|
if (idx >= 0) return idx;
|
||||||
|
return headers.findIndex(h => h.toLowerCase().includes('order'));
|
||||||
|
}, [headers]);
|
||||||
|
|
||||||
const launchHeader = launchDateCol >= 0 ? headers[launchDateCol] : 'Launch Date';
|
const launchHeader = launchDateCol >= 0 ? headers[launchDateCol] : 'Launch Date';
|
||||||
const readyHeader = readyToOrderCol >= 0 ? headers[readyToOrderCol] : 'Ready to Order';
|
const readyHeader = readyToOrderCol >= 0 ? headers[readyToOrderCol] : 'Ready to Order';
|
||||||
|
|||||||
Reference in New Issue
Block a user