From c0eb30472e0031c0b83efc04f92184c56e6bf5b7 Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 13 Nov 2019 22:33:19 +0100 Subject: [PATCH] note and note_content has been needlesly updated when utcDateModified has been the same --- src/services/sync_update.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/sync_update.js b/src/services/sync_update.js index 598984882..08a99693f 100644 --- a/src/services/sync_update.js +++ b/src/services/sync_update.js @@ -53,7 +53,7 @@ async function updateEntity(sync, entity, sourceId) { async function updateNote(entity, sourceId) { const origNote = await sql.getRow("SELECT * FROM notes WHERE noteId = ?", [entity.noteId]); - if (!origNote || origNote.utcDateModified <= entity.utcDateModified) { + if (!origNote || origNote.utcDateModified < entity.utcDateModified) { await sql.transactional(async () => { await sql.replace("notes", entity); @@ -67,7 +67,7 @@ async function updateNote(entity, sourceId) { async function updateNoteContent(entity, sourceId) { const origNoteContent = await sql.getRow("SELECT * FROM note_contents WHERE noteId = ?", [entity.noteId]); - if (!origNoteContent || origNoteContent.utcDateModified <= entity.utcDateModified) { + if (!origNoteContent || origNoteContent.utcDateModified < entity.utcDateModified) { entity.content = entity.content === null ? null : Buffer.from(entity.content, 'base64'); await sql.transactional(async () => {