web/dashboards/garage/js/garage.js
// Increment/Decrement number of occupants
Increment/Decrement number of occupants
Increment / Decrement number of occupants
function updateOccupancy(raddec, isDisappearance) {
  let isOccupant = raddec.transmitterId.startsWith("ac233");
  if(isOccupant) {
    if(!isDisappearance) {
      if(!presenceArray.includes(raddec.transmitterId)) {
        presenceArray.push(raddec.transmitterId);
        occupancyCount.textContent = presenceArray.length;
        console.log(raddec);
      }
    } 
    else {
      if(presenceArray.includes(raddec.transmitterId)) {
        presenceArray.splice(presenceArray.indexOf(raddec.transmitterId), 1);
        occupancyCount.textContent = presenceArray.length;
      }
    }
  }
  return presenceArray.length;
}
function updateOccupancy ( raddec , isDisappearance ) { let isOccupant = raddec . transmitterId . startsWith ( "ac233" ) ; if ( isOccupant ) { if ( ! isDisappearance ) { if ( ! presenceArray . includes ( raddec . transmitterId ) ) { presenceArray . push ( raddec . transmitterId ) ; occupancyCount . textContent = presenceArray . length ; console . log ( raddec ) ; } } else { if ( presenceArray . includes ( raddec . transmitterId ) ) { presenceArray . splice ( presenceArray . indexOf ( raddec . transmitterId ) , 1 ) ; occupancyCount . textContent = presenceArray . length ; } } } return presenceArray . length ; }
Increment/Decrement number of occupants
Increment / Decrement number of occupants