From cf88dd89fcd8f8605e96ed4b2ba894543972359e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Vay=C3=A1?= Date: Thu, 30 Oct 2025 14:55:02 +0100 Subject: [PATCH] remove patch for bug (#9245) --- .../operators/comparators/index.test.ts | 67 ------------------- .../database/operators/comparators/index.ts | 13 +--- 2 files changed, 1 insertion(+), 79 deletions(-) diff --git a/app/products/playbooks/database/operators/comparators/index.test.ts b/app/products/playbooks/database/operators/comparators/index.test.ts index af63db1ad..71a27ce81 100644 --- a/app/products/playbooks/database/operators/comparators/index.test.ts +++ b/app/products/playbooks/database/operators/comparators/index.test.ts @@ -75,71 +75,4 @@ describe('shouldHandlePlaybookChecklistItemRecord', () => { expect(shouldHandlePlaybookChecklistItemRecord(existingRecord, raw)).toBe(true); }); - - it('should return true when condition_action changes even if update_at is the same', () => { - const existingRecord = TestHelper.fakePlaybookChecklistItemModel({ - updateAt: 112233, - conditionAction: '', - }); - const raw = TestHelper.fakePlaybookChecklistItem(existingRecord.checklistId, { - update_at: 112233, - condition_action: 'hidden', - }); - - expect(shouldHandlePlaybookChecklistItemRecord(existingRecord, raw)).toBe(true); - }); - - it('should return true when condition_reason changes even if update_at is the same', () => { - const existingRecord = TestHelper.fakePlaybookChecklistItemModel({ - updateAt: 112233, - conditionReason: '', - }); - const raw = TestHelper.fakePlaybookChecklistItem(existingRecord.checklistId, { - update_at: 112233, - condition_reason: 'Dependent task not completed', - }); - - expect(shouldHandlePlaybookChecklistItemRecord(existingRecord, raw)).toBe(true); - }); - - it('should return false when condition fields are unchanged and update_at is the same', () => { - const existingRecord = TestHelper.fakePlaybookChecklistItemModel({ - updateAt: 112233, - conditionAction: 'hidden', - conditionReason: 'Some reason', - }); - const raw = TestHelper.fakePlaybookChecklistItem(existingRecord.checklistId, { - update_at: 112233, - condition_action: 'hidden', - condition_reason: 'Some reason', - }); - - expect(shouldHandlePlaybookChecklistItemRecord(existingRecord, raw)).toBe(false); - }); - - it('should return true when condition_action changes from hidden to shown_because_modified', () => { - const existingRecord = TestHelper.fakePlaybookChecklistItemModel({ - updateAt: 112233, - conditionAction: 'hidden', - }); - const raw = TestHelper.fakePlaybookChecklistItem(existingRecord.checklistId, { - update_at: 112233, - condition_action: 'shown_because_modified', - }); - - expect(shouldHandlePlaybookChecklistItemRecord(existingRecord, raw)).toBe(true); - }); - - it('should return false when condition_action is undefined in raw data', () => { - const existingRecord = TestHelper.fakePlaybookChecklistItemModel({ - updateAt: 112233, - conditionAction: 'hidden', - }); - const raw = TestHelper.fakePlaybookChecklistItem(existingRecord.checklistId, { - update_at: 112233, - }); - delete raw.condition_action; - - expect(shouldHandlePlaybookChecklistItemRecord(existingRecord, raw)).toBe(false); - }); }); diff --git a/app/products/playbooks/database/operators/comparators/index.ts b/app/products/playbooks/database/operators/comparators/index.ts index 93ef5a9e1..d9d84210b 100644 --- a/app/products/playbooks/database/operators/comparators/index.ts +++ b/app/products/playbooks/database/operators/comparators/index.ts @@ -14,16 +14,5 @@ export const shouldHandlePlaybookChecklistRecord = (existingRecord: PlaybookChec }; export const shouldHandlePlaybookChecklistItemRecord = (existingRecord: PlaybookChecklistItemModel, raw: PartialChecklistItem): boolean => { - // Check if update_at has changed (primary check) - if (existingRecord.updateAt !== raw.update_at) { - return true; - } - - // Check if condition fields have changed (allows updates without update_at change) - const conditionActionChanged = raw.condition_action !== undefined && - existingRecord.conditionAction !== raw.condition_action; - const conditionReasonChanged = raw.condition_reason !== undefined && - existingRecord.conditionReason !== raw.condition_reason; - - return Boolean(conditionActionChanged || conditionReasonChanged); + return Boolean(existingRecord.updateAt !== raw.update_at); };