src/core/resource-manager.js
function initRanges(resources, start, ranges, delays) {
    for(var i = 0, len = resources.length; i < len; i++) {
      var resId = resources[i];

      // handles nested resources (OR)
      if(Array.isArray(resId)) {
        var subRanges = [], subDelays = {};
        initRanges(resId, start, subRanges, subDelays);

        var longDelay = getLongestDelay(subDelays);
        if(longDelay) {
          delays[longDelay] = subDelays[longDelay];
        }

        var schedule = {subRanges: subRanges};
        setEarliestSubRange(schedule);
        ranges.push(schedule);
      }
      else {
        var res = rMap[resId],
            range = res.nextAvail[0] >= start ? res.nextAvail :
                    res.next(start);

        if(range[0] > start && resId !== '_proj') {
          delays[resId] = { needed: start, available: range[0] };
        }

        ranges.push({id: resId, range: range});
      }
    }
  }
function initRanges(resources, start, ranges, delays) {
    for(var i = 0, len = resources.length; i < len; i++) {
      var resId = resources[i];

      // handles nested resources (OR)
      if(Array.isArray(resId)) {
        var subRanges = [], subDelays = {};
        initRanges(resId, start, subRanges, subDelays);

        var longDelay = getLongestDelay(subDelays);
        if(longDelay) {
          delays[longDelay] = subDelays[longDelay];
        }

        var schedule = {subRanges: subRanges};
        setEarliestSubRange(schedule);
        ranges.push(schedule);
      }
      else {
        var res = rMap[resId],
            range = res.nextAvail[0] >= start ? res.nextAvail :
                    res.next(start);

        if(range[0] > start && resId !== '_proj') {
          delays[resId] = { needed: start, available: range[0] };
        }

        ranges.push({id: resId, range: range});
      }
    }
  }
function initRanges ( resources , start , ranges , delays ) { for ( var i = 0 , len = resources . length ; i < len ; i ++ ) { var resId = resources [ i ] ; // handles nested resources (OR) if ( Array . isArray ( resId ) ) { var subRanges = [ ] , subDelays = { } ; initRanges ( resId , start , subRanges , subDelays ) ; var longDelay = getLongestDelay ( subDelays ) ; if ( longDelay ) { delays [ longDelay ] = subDelays [ longDelay ] ; } var schedule = { subRanges : subRanges } ; setEarliestSubRange ( schedule ) ; ranges . push ( schedule ) ; } else { var res = rMap [ resId ] , range = res . nextAvail [ 0 ] >= start ? res . nextAvail : res . next ( start ) ; if ( range [ 0 ] > start && resId !== '_proj' ) { delays [ resId ] = { needed : start , available : range [ 0 ] } ; } ranges . push ( { id : resId , range : range } ) ; } } }
Initializes the resource schedule availablity based on the start date
provided. Resources that were not immediately available are captured in
the delays array to be reported with the reservation.
Initializes the resource schedule availablity based on the start date provided . Resources that were not immediately available are captured in the delays array to be reported with the reservation .