Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit ea47668

Browse files
committed
server: Clarify name
1 parent 81a2b20 commit ea47668

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/services/sync_update.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ function updateEntity(remoteEC: EntityChange, remoteEntityRow: EntityRow, instan
7676

7777
function updateNormalEntity(remoteEC: EntityChange, remoteEntityRow: EntityRow, instanceId: string, updateContext: UpdateContext) {
7878
const localEC = sql.getRow<EntityChange | undefined>(`SELECT * FROM entity_changes WHERE entityName = ? AND entityId = ?`, [remoteEC.entityName, remoteEC.entityId]);
79-
const localECIsOlderThanRemote = (
79+
const localECIsOlderOrSameAsRemote = (
8080
localEC && localEC.utcDateChanged && remoteEC.utcDateChanged &&
8181
localEC.utcDateChanged <= remoteEC.utcDateChanged);
8282

83-
if (!localEC || localECIsOlderThanRemote) {
83+
if (!localEC || localECIsOlderOrSameAsRemote) {
8484
if (remoteEC.isErased) {
8585
if (localEC?.isErased) {
8686
eraseEntity(remoteEC); // make sure it's erased anyway
@@ -103,7 +103,7 @@ function updateNormalEntity(remoteEC: EntityChange, remoteEntityRow: EntityRow,
103103
}
104104

105105
if (!localEC
106-
|| localECIsOlderThanRemote
106+
|| localECIsOlderOrSameAsRemote
107107
|| localEC.hash !== remoteEC.hash
108108
|| localEC.isErased !== remoteEC.isErased
109109
) {
@@ -112,7 +112,7 @@ function updateNormalEntity(remoteEC: EntityChange, remoteEntityRow: EntityRow,
112112

113113
return true;
114114
} else if ((localEC.hash !== remoteEC.hash || localEC.isErased !== remoteEC.isErased)
115-
&& !localECIsOlderThanRemote) {
115+
&& !localECIsOlderOrSameAsRemote) {
116116
// the change on our side is newer than on the other side, so the other side should update
117117
entityChangesService.putEntityChangeForOtherInstances(localEC);
118118

0 commit comments

Comments
 (0)