private ZonelessEventStore GetEventStore(ZonelessEventStore es, string view, int count, DateTime from, DateTime to, string source, Dictionary<string,object> args) { if (args == null) args = new Dictionary<string, object>(); // see RenderDynamicViewWithCaching: // view_data = Encoding.UTF8.GetBytes(view_renderer(eventstore:null, view:view, view:count)); // the renderer might be, e.g., CalendarRenderer.RenderHtml, which calls this method if (es == null) // if no eventstore passed in (e.g., for testing) es = this.es_getter(this.cache); // get the eventstore. if the getter is GetEventStoreWithCaching // then it will use HttpUtils.RetrieveBlobFromServerCacheOrUri // which gets from cache if it can, else fetches uri and loads cache var is_html_renderer = args.HasValue("html_renderer", true); var bare_events = args.HasValue("bare_events", true); var is_view = !String.IsNullOrEmpty(view); if (is_html_renderer) { MaybeBuildTagStructures(es); // transitional until new generation of objects is fully established if (bare_events) count = 0; } if (args.HasValue("advance_to_an_hour_ago", true) && ! bare_events) es.AdvanceToAnHourAgo(this.calinfo); view = MaybeAddHubTagToView(view, args); var original_count = es.events.Count(); es.events = Filter(view, count, from, to, source, es, args); // apply all filters if (is_view) { if (es.days_and_counts != null) // this check needed only until new generation of objects is established es.PopulateDaysAndCounts(); // mainly for html renderer but could be useful to non-html renderers as well } return es; }
private List<string> GetDayAnchors(ZonelessEventStore es, string view) { if (es == null) // if no eventstore passed in (e.g., for testing) es = this.es_getter(this.cache); es.AdvanceToAnHourAgo(this.calinfo); var filtered_events = ViewFilter(view, es.events); var day_anchors = new List<string>(); foreach (ZonelessEvent evt in filtered_events) { string datekey = Utils.DateKeyFromDateTime(evt.dtstart); if (!day_anchors.Exists(d => d == datekey)) { day_anchors.Add(datekey); } } return day_anchors; }