mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 17:15:23 +02:00
restore legacy cpnp history index
This commit is contained in:
+8
-2
@@ -3,6 +3,7 @@ import { COLUMNS } from '../types';
|
||||
|
||||
const SUPABASE_URL = 'https://hwithddwaapyhnfwcesj.supabase.co';
|
||||
const SUPABASE_ANON_KEY = 'sb_publishable_fGXkh0bSrAOqSk2jWKAzSg_NJD9YPCv';
|
||||
const LEGACY_CPNP_INDEX = 77;
|
||||
|
||||
export async function safeFetch(url: string, options: RequestInit = {}): Promise<Response> {
|
||||
const session = getStoredSession();
|
||||
@@ -330,10 +331,15 @@ export async function getHistoryDataForMerge(): Promise<Record<string, ExcelRow>
|
||||
// does not surface it as a changed index.
|
||||
const latestCpnp =
|
||||
entry.new_data?.[COLUMNS.CPNP_NO] ??
|
||||
entry.new_data?.[LEGACY_CPNP_INDEX] ??
|
||||
entry.old_data?.[COLUMNS.CPNP_NO];
|
||||
const fallbackCpnp =
|
||||
latestCpnp !== undefined && latestCpnp !== null && latestCpnp !== ''
|
||||
? latestCpnp
|
||||
: entry.old_data?.[LEGACY_CPNP_INDEX];
|
||||
|
||||
if (latestCpnp !== undefined && latestCpnp !== null && latestCpnp !== '') {
|
||||
target[COLUMNS.CPNP_NO] = latestCpnp;
|
||||
if (fallbackCpnp !== undefined && fallbackCpnp !== null && fallbackCpnp !== '') {
|
||||
target[COLUMNS.CPNP_NO] = fallbackCpnp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user