public async Task <IActionResult> Index() { var from = DateTime.MinValue; var to = DateTime.MaxValue; var total = await _analyticStore.CountAsync(from, to); if (total == 0) { await LoadDemoData(_analyticStore); } var stat = new WebStat { TotalServed = await _analyticStore.CountAsync(from, to), UniqueVisitors = await _analyticStore.CountUniqueIndentitiesAsync(from, to), DailyAverage = await _analyticStore.DailyAverage(from, to), DailyServed = await _analyticStore.DailyServed(from, to), HourlyServed = await _analyticStore.HourlyServed(from, to), ServedByCountry = await _analyticStore.ServedByCountry(from, to), UrlServed = await _analyticStore.UrlServed(from, to), Requests = await _analyticStore.InTimeRange(DateTime.Now - TimeSpan.FromDays(1), DateTime.Now) }; return(View(stat)); }
public static async Task TestCountIdentities(IAnalyticStore store) { foreach (var request in MatteoRequests) { await store.StoreWebRequestAsync(request); } Assert.Equal(1, await store.CountUniqueIndentitiesAsync(DateTime.Today)); Assert.Equal(1, await store.CountUniqueIndentitiesAsync(DateTime.MinValue, DateTime.MaxValue)); foreach (var request in FrancoRequests) { await store.StoreWebRequestAsync(request); } Assert.Equal(2, await store.CountUniqueIndentitiesAsync(DateTime.Today)); Assert.Equal(2, await store.CountUniqueIndentitiesAsync(DateTime.MinValue, DateTime.MaxValue)); }
public async Task <ActionResult> Index() { var from = DateTime.MinValue; var to = DateTime.MaxValue; var stat = new WebStat { TotalServed = await _store.CountAsync(from, to), UniqueVisitors = await _store.CountUniqueIndentitiesAsync(from, to), DailyAverage = await _store.DailyAverage(from, to), DailyServed = await _store.DailyServed(from, to), HourlyServed = await _store.HourlyServed(from, to), ServedByCountry = await _store.ServedByCountry(from, to), UrlServed = await _store.UrlServed(from, to), Requests = (await _store.InTimeRange(DateTime.Now - TimeSpan.FromMinutes(30), DateTime.Now)) .OrderByDescending(x => x.Timestamp) }; return(View(stat)); }
public Task <long> CountUniqueIndentitiesAsync(DateTime day) => store.CountUniqueIndentitiesAsync(day);