/// <summary> /// Call this method with the personalization rules that are relevant to the visitor to get the variations to show/include. /// For example, if a personalization rule shows a sausage to German visitors then the rule should be included here only for Germans. /// </summary> public VisitContext CreateContext(Visit visit) { var key = DistributeEvenlyForSubGroups ? _rules.Select((r, i) => r.IsRelevant(visit) ? 2L << i : 0) .Aggregate(0L, (current, value) => current |= value) : 0L; RoundRobinCounter counter; counter = _counters.TryGetValue(key, out counter) ? counter : _counters[key] = new RoundRobinCounter(new[] {Test.Experiences.Count}); visit.UpdateState(Test.Experiences[counter.Next[0]]); return new VisitContext(this, visit); }
public Visit SpawnVisit() { var v = new Visit() { Group = this }; v.UpdateState(); var group = this; while (group != null) { if (group.Action != null) { v.Action = group.Action; break; } group = group.BaseGroup; } //if (PageSequenceGenerator != null) //{ // v.Pages.AddRange(PageSequenceGenerator.Generate(v)); //} return v; }