mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 08:21:53 +00:00
Merge branch 'main' into next
This commit is contained in:
commit
35da486e63
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user