Skip to content

Commit

Permalink
Filter meetings considered to be conflicts to unstarted ones
Browse files Browse the repository at this point in the history
  • Loading branch information
ssciolla authored and jlost committed Feb 22, 2021
1 parent a3b5afe commit 9557e36
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/assets/src/validation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { string, StringSchema, SchemaDescription, TestMessageParams } from 'yup';
import { MeetingBackend, QueueHost } from "./models";
import { MeetingBackend, MeetingStatus, QueueHost } from "./models";
import { getUser } from "./services/api";

// Yup: https://github.com/jquense/yup
Expand Down Expand Up @@ -102,8 +102,9 @@ export function validateMeetingTypes (value: Set<string>, backends: MeetingBacke

let existingMeetingConflict = false;
if (queue) {
const uniqueMeetingTypes = new Set(queue!.meeting_set.map(m => m.backend_type));
const conflictingTypes = [...uniqueMeetingTypes]
const unstartedMeetings = queue!.meeting_set.filter(m => m.status !== MeetingStatus.STARTED);
const uniqueUnstartedMeetingTypes = new Set(unstartedMeetings.map(m => m.backend_type));
const conflictingTypes = [...uniqueUnstartedMeetingTypes]
.filter(uniqueMeetingType => !value.has(uniqueMeetingType));
const conflictingTypeNames = conflictingTypes
.map(ct => backends.find(b => b.name === ct)?.friendly_name ?? ct);
Expand Down

0 comments on commit 9557e36

Please sign in to comment.