diff --git a/front/src/config/i18n/de.json b/front/src/config/i18n/de.json index 2ef3b832c0..c737ef4dc7 100644 --- a/front/src/config/i18n/de.json +++ b/front/src/config/i18n/de.json @@ -2155,6 +2155,7 @@ "nameLabel": "Wenn der Name", "isExactly": "genau ist", "contains": "enthält", + "doesNotContain": "enthält nicht", "startsWith": "beginnt mit", "endsWith": "endet mit", "hasAnyName": "einen beliebigen Namen hat", diff --git a/front/src/config/i18n/en.json b/front/src/config/i18n/en.json index 05c245aa73..ed57f1eddf 100644 --- a/front/src/config/i18n/en.json +++ b/front/src/config/i18n/en.json @@ -2155,6 +2155,7 @@ "nameLabel": "If the name", "isExactly": "is exactly", "contains": "contains", + "doesNotContain": "does not contain", "startsWith": "starts with", "endsWith": "ends with", "hasAnyName": "has any name", diff --git a/front/src/config/i18n/fr.json b/front/src/config/i18n/fr.json index a23d5b0bac..768cb9d86e 100644 --- a/front/src/config/i18n/fr.json +++ b/front/src/config/i18n/fr.json @@ -2155,6 +2155,7 @@ "nameLabel": "Si le nom", "isExactly": "est exactement", "contains": "contient", + "doesNotContain": "ne contient pas", "startsWith": "commence par", "endsWith": "finit par", "hasAnyName": "a n'importe quel nom", diff --git a/front/src/routes/scene/edit-scene/actions/CalendarIsEventRunning.jsx b/front/src/routes/scene/edit-scene/actions/CalendarIsEventRunning.jsx index d4d662165e..44c6f15ca9 100644 --- a/front/src/routes/scene/edit-scene/actions/CalendarIsEventRunning.jsx +++ b/front/src/routes/scene/edit-scene/actions/CalendarIsEventRunning.jsx @@ -217,6 +217,9 @@ class CheckTime extends Component { + diff --git a/server/lib/calendar/calendar.findCurrentlyRunningEvent.js b/server/lib/calendar/calendar.findCurrentlyRunningEvent.js index 52f8ef3aa3..4ea8d5d0bc 100644 --- a/server/lib/calendar/calendar.findCurrentlyRunningEvent.js +++ b/server/lib/calendar/calendar.findCurrentlyRunningEvent.js @@ -54,6 +54,12 @@ async function findCurrentlyRunningEvent(calendars, calendarEventNameComparator, [Op.like]: `%${calendarEventName}%`, }; break; + case 'does-not-contain': + // @ts-ignore + queryParams.where.name = { + [Op.notLike]: `%${calendarEventName}%`, + }; + break; case 'starts-with': // @ts-ignore queryParams.where.name = { diff --git a/server/models/scene.js b/server/models/scene.js index 8143ab3097..19da613edd 100644 --- a/server/models/scene.js +++ b/server/models/scene.js @@ -33,6 +33,7 @@ const actionSchema = Joi.array().items( calendar_event_name_comparator: Joi.string().valid( 'is-exactly', 'contains', + 'does-not-contain', 'starts-with', 'ends-with', 'has-any-name', diff --git a/server/test/lib/calendar/calendar.event.test.js b/server/test/lib/calendar/calendar.event.test.js index a4d1bc40a3..20ed957408 100644 --- a/server/test/lib/calendar/calendar.event.test.js +++ b/server/test/lib/calendar/calendar.event.test.js @@ -302,6 +302,21 @@ describe('calendar.findCurrentlyRunningEvent', () => { const eventsId = events.map((e) => e.id); expect(eventsId).deep.equal(['a2b57b0a-7148-4961-8540-e493104bfd7c']); }); + it('should find event in calendar - does not contain', async () => { + await calendar.createEvent('test-calendar', { + id: 'a2b57b0a-7148-4961-8540-e493104bfd7c', + name: 'my test event', + start: startDate, + end: endDate, + }); + const events = await calendar.findCurrentlyRunningEvent( + ['test-calendar', 'test-calendar-random'], + 'does-not-contain', + 'random', + ); + const eventsId = events.map((e) => e.id); + expect(eventsId).deep.equal(['a2b57b0a-7148-4961-8540-e493104bfd7c']); + }); it('should find event in calendar - starts-with', async () => { await calendar.createEvent('test-calendar', { id: 'a2b57b0a-7148-4961-8540-e493104bfd7c',