function proposedNewSeatsOverlap(dtos) {
  for (let i = 0; i < dtos.length; i++) {
    let step = dtos[i]["step"];
    let controls = [];
    let targets = [];

    if (Object.prototype.hasOwnProperty.call(dtos[i], "targets")) {
      targets = dtos[i]["targets"];
    }

    if (Object.prototype.hasOwnProperty.call(dtos[i], "controls")) {
      controls = dtos[i].controls;
    }
    let qbits = [...targets, ...controls];

    for (let j = i + 1; j < dtos.length; j++) {
      let step2 = dtos[j]["step"];
      if (step != step2) continue;
      let targetsSecond = [];
      let controlsSecond = [];
      if (Object.prototype.hasOwnProperty.call(dtos[j], "targets")) {
        targetsSecond = dtos[j].targets;
      }
      if (Object.prototype.hasOwnProperty.call(dtos[j], "controls")) {
        controlsSecond = dtos[j].controls;
      }
      let qbitsSecond = [...targetsSecond, ...controlsSecond];
      for (let k = 0; k < qbits.length ; k++){
        let qbit = qbits[k];
        if (qbitsSecond.includes(qbit)){
          return true;
        }
      }
    }
  }
  return false; 
}
// Verify if the some of the new proposed seats overlap
Verify if the some of the new proposed seats overlap
Verify if the some of the new proposed seats overlap
function proposedNewSeatsOverlap(dtos) {
  for (let i = 0; i < dtos.length; i++) {
    let step = dtos[i]["step"];
    let controls = [];
    let targets = [];
    if (Object.prototype.hasOwnProperty.call(dtos[i], "targets")) {
      targets = dtos[i]["targets"];
    }
    if (Object.prototype.hasOwnProperty.call(dtos[i], "controls")) {
      controls = dtos[i].controls;
    }
    let qbits = [...targets, ...controls];
    for (let j = i + 1; j < dtos.length; j++) {
      let step2 = dtos[j]["step"];
      if (step != step2) continue;
      let targetsSecond = [];
      let controlsSecond = [];
      if (Object.prototype.hasOwnProperty.call(dtos[j], "targets")) {
        targetsSecond = dtos[j].targets;
      }
      if (Object.prototype.hasOwnProperty.call(dtos[j], "controls")) {
        controlsSecond = dtos[j].controls;
      }
      let qbitsSecond = [...targetsSecond, ...controlsSecond];
      for (let k = 0; k < qbits.length ; k++){
        let qbit = qbits[k];
        if (qbitsSecond.includes(qbit)){
          return true;
        }
      }
    }
  }
  return false; 
}
function proposedNewSeatsOverlap ( dtos ) { for ( let i = 0 ; i < dtos . length ; i ++ ) { let step = dtos [ i ] [ "step" ] ; let controls = [ ] ; let targets = [ ] ; if ( Object . prototype . hasOwnProperty . call ( dtos [ i ] , "targets" ) ) { targets = dtos [ i ] [ "targets" ] ; } if ( Object . prototype . hasOwnProperty . call ( dtos [ i ] , "controls" ) ) { controls = dtos [ i ] . controls ; } let qbits = [ ... targets , ... controls ] ; for ( let j = i + 1 ; j < dtos . length ; j ++ ) { let step2 = dtos [ j ] [ "step" ] ; if ( step != step2 ) continue ; let targetsSecond = [ ] ; let controlsSecond = [ ] ; if ( Object . prototype . hasOwnProperty . call ( dtos [ j ] , "targets" ) ) { targetsSecond = dtos [ j ] . targets ; } if ( Object . prototype . hasOwnProperty . call ( dtos [ j ] , "controls" ) ) { controlsSecond = dtos [ j ] . controls ; } let qbitsSecond = [ ... targetsSecond , ... controlsSecond ] ; for ( let k = 0 ; k < qbits . length ; k ++ ) { let qbit = qbits [ k ] ; if ( qbitsSecond . includes ( qbit ) ) { return true ; } } } } return false ; }
Verify if the some of the new proposed seats overlap
Verify if the some of the new proposed seats overlap