remove patch for bug (#9245)

This commit is contained in:
Guillermo Vayá 2025-10-30 14:55:02 +01:00 committed by GitHub
parent dbd7575f41
commit cf88dd89fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1 additions and 79 deletions

View file

@ -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);
});
});

View file

@ -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);
};