MCPcopy Create free account
hub / github.com/DHTMLX/scheduler / iter

Function iter

codebase/sources/dhtmlxscheduler.es.js:17661–17734  ·  view source on GitHub ↗
(iterResult, options)

Source from the content-addressed store, hash-verified

17659 return poslist;
17660}
17661function iter(iterResult, options) {
17662 var dtstart = options.dtstart, freq = options.freq, interval = options.interval, until = options.until, bysetpos = options.bysetpos;
17663 var count = options.count;
17664 if (count === 0 || interval === 0) {
17665 return emitResult(iterResult);
17666 }
17667 var counterDate = DateTime.fromDate(dtstart);
17668 var ii = new Iterinfo(options);
17669 ii.rebuild(counterDate.year, counterDate.month);
17670 var timeset = makeTimeset(ii, counterDate, options);
17671 for (; ; ) {
17672 var _a = ii.getdayset(freq)(counterDate.year, counterDate.month, counterDate.day), dayset = _a[0], start = _a[1], end = _a[2];
17673 var filtered = removeFilteredDays(dayset, start, end, ii, options);
17674 if (notEmpty(bysetpos)) {
17675 var poslist = buildPoslist(bysetpos, timeset, start, end, ii, dayset);
17676 for (var j = 0; j < poslist.length; j++) {
17677 var res = poslist[j];
17678 if (until && res > until) {
17679 return emitResult(iterResult);
17680 }
17681 if (res >= dtstart) {
17682 var rezonedDate = rezoneIfNeeded(res, options);
17683 if (!iterResult.accept(rezonedDate)) {
17684 return emitResult(iterResult);
17685 }
17686 if (count) {
17687 --count;
17688 if (!count) {
17689 return emitResult(iterResult);
17690 }
17691 }
17692 }
17693 }
17694 } else {
17695 for (var j = start; j < end; j++) {
17696 var currentDay = dayset[j];
17697 if (!isPresent(currentDay)) {
17698 continue;
17699 }
17700 var date = fromOrdinal(ii.yearordinal + currentDay);
17701 for (var k = 0; k < timeset.length; k++) {
17702 var time = timeset[k];
17703 var res = combine(date, time);
17704 if (until && res > until) {
17705 return emitResult(iterResult);
17706 }
17707 if (res >= dtstart) {
17708 var rezonedDate = rezoneIfNeeded(res, options);
17709 if (!iterResult.accept(rezonedDate)) {
17710 return emitResult(iterResult);
17711 }
17712 if (count) {
17713 --count;
17714 if (!count) {
17715 return emitResult(iterResult);
17716 }
17717 }
17718 }

Callers 2

iterSetFunction · 0.70

Calls 11

emitResultFunction · 0.70
makeTimesetFunction · 0.70
removeFilteredDaysFunction · 0.70
notEmptyFunction · 0.70
buildPoslistFunction · 0.70
rezoneIfNeededFunction · 0.70
isPresentFunction · 0.70
fromOrdinalFunction · 0.70
combineFunction · 0.70
freqIsDailyOrGreaterFunction · 0.70
addMethod · 0.65

Tested by

no test coverage detected