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

Function iter

codebase/sources/dhtmlxscheduler.js:17665–17738  ·  view source on GitHub ↗
(iterResult, options)

Source from the content-addressed store, hash-verified

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

Callers 2

dhtmlxscheduler.jsFile · 0.70
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