fix: improve record comparison by normalizing whitespace in invoice IDs during database sync
Deploy Application / deploy (push) Successful in 36s
Details
Deploy Application / deploy (push) Successful in 36s
Details
This commit is contained in:
parent
c911d02cd6
commit
f248c5889f
|
|
@ -143,10 +143,19 @@ async function processDatabaseSync(database: any) {
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const op of ops) {
|
for (const op of ops) {
|
||||||
|
const removeSpace = (string: string) => {
|
||||||
|
return string
|
||||||
|
.replace(
|
||||||
|
/[\s\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u3000\uFEFF]/g,
|
||||||
|
" "
|
||||||
|
)
|
||||||
|
.replace(/\s+/g, " ")
|
||||||
|
.trim();
|
||||||
|
};
|
||||||
const existData = existingRecords.find(
|
const existData = existingRecords.find(
|
||||||
(record) =>
|
(record) =>
|
||||||
JSON.stringify(record.c_invoice_id) ===
|
removeSpace(JSON.stringify(record.c_invoice_id)) ===
|
||||||
JSON.stringify(op.c_invoice_id)
|
removeSpace(JSON.stringify(op.c_invoice_id))
|
||||||
);
|
);
|
||||||
const existingId = existData ? existData.id : null;
|
const existingId = existData ? existData.id : null;
|
||||||
if (existingId) {
|
if (existingId) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue