Merge branch 'main' into next

This commit is contained in:
GitHub Actions Bot 2024-07-27 06:35:42 +00:00
commit 35da486e63
2 changed files with 26 additions and 1 deletions

View File

@ -377,5 +377,30 @@ describe('workflow > triggers > schedule > date field mode', () => {
const e2c = await workflow.countExecutions();
expect(e2c).toBe(2);
});
it('empty endsOn as no end', async () => {
const workflow = await WorkflowModel.create({
enabled: true,
type: 'schedule',
config: {
mode: 1,
collection: 'posts',
startsOn: {
field: 'createdAt',
},
repeat: 1000,
endsOn: {},
},
});
await sleepToEvenSecond();
const post = await PostRepo.create({ values: { title: 't1' } });
await sleep(1700);
const e1c = await workflow.countExecutions();
expect(e1c).toBe(2);
});
});
});

View File

@ -54,7 +54,7 @@ function getDataOptionTime(record, on, dir = 1) {
}
case 'object': {
const { field, offset = 0, unit = 1000 } = on;
if (!record.get(field)) {
if (!field || !record.get(field)) {
return null;
}
const second = new Date(record.get(field).getTime());