mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 17:25:24 +02:00
fix: preserve app edits from Supabase (shows in Change History)
This commit is contained in:
+4
-5
@@ -166,9 +166,8 @@ export default function App() {
|
|||||||
// Start with Dropbox values (default)
|
// Start with Dropbox values (default)
|
||||||
let finalRow = [...row];
|
let finalRow = [...row];
|
||||||
|
|
||||||
// Only preserve Supabase values if there's a PENDING manual edit
|
// Preserve Supabase values (edits made in the app) - this shows in Change History
|
||||||
// NOT for 'synced' status - we want fresh Dropbox data to overwrite
|
if (synced) {
|
||||||
if (synced && synced.status === 'pending') {
|
|
||||||
// DETECT COLUMN SHIFT: If the saved data uses the old structure (where index 12 was a numeric date),
|
// DETECT COLUMN SHIFT: If the saved data uses the old structure (where index 12 was a numeric date),
|
||||||
// we need to shift all indices from 12 onwards by +1 to match today's Excel structure.
|
// we need to shift all indices from 12 onwards by +1 to match today's Excel structure.
|
||||||
const oldData = synced.data;
|
const oldData = synced.data;
|
||||||
@@ -187,9 +186,9 @@ export default function App() {
|
|||||||
finalRow[idx] = oldData[mergeIdx];
|
finalRow[idx] = oldData[mergeIdx];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setRowStatuses(prev => ({ ...prev, [articleNo]: synced.status }));
|
setRowStatuses(prev => ({ ...prev, [articleNo]: synced.status || 'synced' }));
|
||||||
}
|
}
|
||||||
// Otherwise use Dropbox values (default - will show 4.5 not 4.95)
|
// Otherwise use Dropbox values (don't merge, just process formatting)
|
||||||
|
|
||||||
return finalRow.map((val: any, idx: number) => {
|
return finalRow.map((val: any, idx: number) => {
|
||||||
if (val === undefined || val === null || val === '') return val;
|
if (val === undefined || val === null || val === '') return val;
|
||||||
|
|||||||
Reference in New Issue
Block a user