function analyzeRoundRobinDrawPositions(params) {
  const { unfilledPositions, chunkedDrawPositions } = params;
  const profiledPositions = getPositionProfiles(params);

  const checkedChunk = chunkedDrawPositions.map((chunkedGrouping) => {
    const unassigned = unfilledPositions.filter((unfilledPosition) =>
      chunkedGrouping.includes(unfilledPosition)
    );
    const unpaired =
      unassigned.length === chunkedGrouping.length ? unassigned : [];
    const conflictsCount = chunkedGrouping.filter(
      (drawPosition) => profiledPositions[drawPosition]?.includesGroupsToAvoid
    ).length;
    const pairedNoConflict = conflictsCount ? [] : unassigned;
    return { unassigned, unpaired, pairedNoConflict, conflictsCount };
  });

  return checkedChunk;
}
/**
 *
 * @param {string[]} allGroups - group names derived from participant attributes which match policyAttributes
 * @param {string[]} groupsToAvoid - names of groups which contain the participantId currently being placed
 * @param {number[]} unfilledPositions - drawPositions which have not been assigned a participantid
 * @param {object[]} positionAssignments - array of assignment objects
 * @param {object[]} chunkedDrawPositions - array of arrays of drawPositions
 *
 * Returns different types of placement options.
 * 1. positions which are unassigned
 * 2. unassigned positions which are not paired with any other participantId
 * 3. unassigned positions which are paired and which have no conflicting groupings (groupings to avoid)
 *
 */


Returns different types of placement options.
1. positions which are unassigned
2. unassigned positions which are not paired with any other participantId
3. unassigned positions which are paired and which have no conflicting groupings (groupings to avoid)
Returns different types of placement options . 1 . positions which are unassigned 2 . unassigned positions which are not paired with any other participantId 3 . unassigned positions which are paired and which have no conflicting groupings ( groupings to avoid )
function analyzeRoundRobinDrawPositions(params) {
  const { unfilledPositions, chunkedDrawPositions } = params;
  const profiledPositions = getPositionProfiles(params);
  const checkedChunk = chunkedDrawPositions.map((chunkedGrouping) => {
    const unassigned = unfilledPositions.filter((unfilledPosition) =>
      chunkedGrouping.includes(unfilledPosition)
    );
    const unpaired =
      unassigned.length === chunkedGrouping.length ? unassigned : [];
    const conflictsCount = chunkedGrouping.filter(
      (drawPosition) => profiledPositions[drawPosition]?.includesGroupsToAvoid
    ).length;
    const pairedNoConflict = conflictsCount ? [] : unassigned;
    return { unassigned, unpaired, pairedNoConflict, conflictsCount };
  });
  return checkedChunk;
}
function analyzeRoundRobinDrawPositions ( params ) { const { unfilledPositions , chunkedDrawPositions } = params ; const profiledPositions = getPositionProfiles ( params ) ; const checkedChunk = chunkedDrawPositions . map ( ( chunkedGrouping ) => { const unassigned = unfilledPositions . filter ( ( unfilledPosition ) => chunkedGrouping . includes ( unfilledPosition ) ) ; const unpaired = unassigned . length === chunkedGrouping . length ? unassigned : [ ] ; const conflictsCount = chunkedGrouping . filter ( ( drawPosition ) => profiledPositions [ drawPosition ] ?. includesGroupsToAvoid ) . length ; const pairedNoConflict = conflictsCount ? [ ] : unassigned ; return { unassigned , unpaired , pairedNoConflict , conflictsCount } ; } ) ; return checkedChunk ; }
@param {string[]} allGroups - group names derived from participant attributes which match policyAttributes
 @param {string[]} groupsToAvoid - names of groups which contain the participantId currently being placed
 @param {number[]} unfilledPositions - drawPositions which have not been assigned a participantid
 @param {object[]} positionAssignments - array of assignment objects
 @param {object[]} chunkedDrawPositions - array of arrays of drawPositions
@param { string [] } allGroups - group names derived from participant attributes which match policyAttributes @param { string [] } groupsToAvoid - names of groups which contain the participantId currently being placed @param { number [] } unfilledPositions - drawPositions which have not been assigned a participantid @param { object [] } positionAssignments - array of assignment objects @param { object [] } chunkedDrawPositions - array of arrays of drawPositions