/// <summary> Gets the given request. </summary> /// <param name="request"> The request. </param> /// <returns> A Task<object> </returns> public async Task<object> Get(GetReportStatistics request) { if (string.IsNullOrEmpty(request.IncludeItemTypes)) return null; request.DisplayType = "Screen"; var reportResult = await GetReportStatistic(request); return ToOptimizedResult(reportResult); }
/// <summary> Gets report statistic. </summary> /// <param name="request"> The request. </param> /// <returns> The report statistic. </returns> private async Task<ReportStatResult> GetReportStatistic(GetReportStatistics request) { ReportIncludeItemTypes reportRowType = ReportHelper.GetRowType(request.IncludeItemTypes); QueryResult<BaseItem> queryResult = await GetQueryResult(request).ConfigureAwait(false); ReportStatBuilder reportBuilder = new ReportStatBuilder(_libraryManager); ReportStatResult reportResult = reportBuilder.GetResult(queryResult.Items, ReportHelper.GetRowType(request.IncludeItemTypes), request.TopItems ?? 5); reportResult.TotalRecordCount = reportResult.Groups.Count(); return reportResult; }
/// <summary> Gets the given request. </summary> /// <param name="request"> The request. </param> /// <returns> A Task<object> </returns> public async Task<object> Get(GetReportStatistics request) { if (string.IsNullOrEmpty(request.IncludeItemTypes)) return null; request.DisplayType = "Screen"; var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null; var reportResult = await GetReportStatistic(request, user); return ToOptimizedResult(reportResult); }