Beispiel #1
0
        public IActionResult DownloadUsageData(
            int?jobGroupId,
            int?courseCategoryId,
            int?customisationId,
            string startDate,
            string endDate,
            ReportInterval reportInterval
            )
        {
            var centreId = User.GetCentreId();
            var adminCategoryIdFilter = User.GetAdminCourseCategoryFilter();

            var dateRange =
                activityService.GetValidatedUsageStatsDateRange(startDate, endDate, centreId);

            if (dateRange == null)
            {
                return(new NotFoundResult());
            }

            var filterData = new ActivityFilterData(
                dateRange.Value.startDate,
                dateRange.Value.endDate,
                jobGroupId,
                adminCategoryIdFilter ?? courseCategoryId,
                customisationId,
                customisationId.HasValue ? CourseFilterType.Course : CourseFilterType.CourseCategory,
                reportInterval
                );

            var dataFile = activityService.GetActivityDataFileForCentre(centreId, filterData);

            var fileName = $"Activity data for centre {centreId} downloaded {DateTime.Today:yyyy-MM-dd}.xlsx";

            return(File(
                       dataFile,
                       FileHelper.GetContentTypeFromFileName(fileName),
                       fileName
                       ));
        }
Beispiel #2
0
        public IActionResult DownloadEvaluationSummaries(
            int?jobGroupId,
            int?courseCategoryId,
            int?customisationId,
            string startDate,
            string endDate,
            ReportInterval reportInterval
            )
        {
            var centreId = User.GetCentreId();
            var adminCategoryIdFilter = User.GetAdminCourseCategoryFilter();

            var dateRange =
                activityService.GetValidatedUsageStatsDateRange(startDate, endDate, centreId);

            if (dateRange == null)
            {
                return(new NotFoundResult());
            }

            var filterData = new ActivityFilterData(
                dateRange.Value.startDate,
                dateRange.Value.endDate,
                jobGroupId,
                adminCategoryIdFilter ?? courseCategoryId,
                customisationId,
                customisationId.HasValue ? CourseFilterType.Course : CourseFilterType.CourseCategory,
                reportInterval
                );

            var content = evaluationSummaryService.GetEvaluationSummaryFileForCentre(centreId, filterData);

            return(File(
                       content,
                       FileHelper.ExcelContentType,
                       $"DLS Evaluation Stats {DateTime.Today:yyyy-MM-dd}.xlsx"
                       ));
        }
        public void GetPeriodsBetweenDates_returns_single_entry_for_dates_in_same_period(ReportInterval interval)
        {
            // when
            var startDate = DateTime.Parse("2014-01-01 00:00:00.000");
            var endDate   = DateTime.Parse("2014-01-01 23:59:59.999");
            var result    = DateHelper.GetPeriodsBetweenDates(startDate, endDate, interval).ToList();

            // then
            result.Count.Should().Be(1);
        }
 public ReportInputFilter(JToken node) : base(node)
 {
     if (node["keywords"] != null)
     {
         this._Keywords = node["keywords"].Value <string>();
     }
     if (node["searchInTags"] != null)
     {
         this._SearchInTags = ParseBool(node["searchInTags"].Value <string>());
     }
     if (node["searchInAdminTags"] != null)
     {
         this._SearchInAdminTags = ParseBool(node["searchInAdminTags"].Value <string>());
     }
     if (node["categories"] != null)
     {
         this._Categories = node["categories"].Value <string>();
     }
     if (node["categoriesIdsIn"] != null)
     {
         this._CategoriesIdsIn = node["categoriesIdsIn"].Value <string>();
     }
     if (node["customVar1In"] != null)
     {
         this._CustomVar1In = node["customVar1In"].Value <string>();
     }
     if (node["customVar2In"] != null)
     {
         this._CustomVar2In = node["customVar2In"].Value <string>();
     }
     if (node["customVar3In"] != null)
     {
         this._CustomVar3In = node["customVar3In"].Value <string>();
     }
     if (node["deviceIn"] != null)
     {
         this._DeviceIn = node["deviceIn"].Value <string>();
     }
     if (node["countryIn"] != null)
     {
         this._CountryIn = node["countryIn"].Value <string>();
     }
     if (node["regionIn"] != null)
     {
         this._RegionIn = node["regionIn"].Value <string>();
     }
     if (node["citiesIn"] != null)
     {
         this._CitiesIn = node["citiesIn"].Value <string>();
     }
     if (node["operatingSystemFamilyIn"] != null)
     {
         this._OperatingSystemFamilyIn = node["operatingSystemFamilyIn"].Value <string>();
     }
     if (node["operatingSystemIn"] != null)
     {
         this._OperatingSystemIn = node["operatingSystemIn"].Value <string>();
     }
     if (node["browserFamilyIn"] != null)
     {
         this._BrowserFamilyIn = node["browserFamilyIn"].Value <string>();
     }
     if (node["browserIn"] != null)
     {
         this._BrowserIn = node["browserIn"].Value <string>();
     }
     if (node["timeZoneOffset"] != null)
     {
         this._TimeZoneOffset = ParseInt(node["timeZoneOffset"].Value <string>());
     }
     if (node["interval"] != null)
     {
         this._Interval = (ReportInterval)StringEnum.Parse(typeof(ReportInterval), node["interval"].Value <string>());
     }
     if (node["mediaTypeIn"] != null)
     {
         this._MediaTypeIn = node["mediaTypeIn"].Value <string>();
     }
     if (node["sourceTypeIn"] != null)
     {
         this._SourceTypeIn = node["sourceTypeIn"].Value <string>();
     }
     if (node["ownerIdsIn"] != null)
     {
         this._OwnerIdsIn = node["ownerIdsIn"].Value <string>();
     }
     if (node["entryOperator"] != null)
     {
         this._EntryOperator = ObjectFactory.Create <ESearchEntryOperator>(node["entryOperator"]);
     }
     if (node["entryCreatedAtGreaterThanOrEqual"] != null)
     {
         this._EntryCreatedAtGreaterThanOrEqual = ParseInt(node["entryCreatedAtGreaterThanOrEqual"].Value <string>());
     }
     if (node["entryCreatedAtLessThanOrEqual"] != null)
     {
         this._EntryCreatedAtLessThanOrEqual = ParseInt(node["entryCreatedAtLessThanOrEqual"].Value <string>());
     }
     if (node["entryIdIn"] != null)
     {
         this._EntryIdIn = node["entryIdIn"].Value <string>();
     }
     if (node["playbackTypeIn"] != null)
     {
         this._PlaybackTypeIn = node["playbackTypeIn"].Value <string>();
     }
     if (node["playbackContextIdsIn"] != null)
     {
         this._PlaybackContextIdsIn = node["playbackContextIdsIn"].Value <string>();
     }
     if (node["rootEntryIdIn"] != null)
     {
         this._RootEntryIdIn = node["rootEntryIdIn"].Value <string>();
     }
     if (node["errorCodeIn"] != null)
     {
         this._ErrorCodeIn = node["errorCodeIn"].Value <string>();
     }
     if (node["playerVersionIn"] != null)
     {
         this._PlayerVersionIn = node["playerVersionIn"].Value <string>();
     }
     if (node["ispIn"] != null)
     {
         this._IspIn = node["ispIn"].Value <string>();
     }
     if (node["applicationVersionIn"] != null)
     {
         this._ApplicationVersionIn = node["applicationVersionIn"].Value <string>();
     }
     if (node["nodeIdsIn"] != null)
     {
         this._NodeIdsIn = node["nodeIdsIn"].Value <string>();
     }
     if (node["categoriesAncestorIdIn"] != null)
     {
         this._CategoriesAncestorIdIn = node["categoriesAncestorIdIn"].Value <string>();
     }
     if (node["hotspotIdIn"] != null)
     {
         this._HotspotIdIn = node["hotspotIdIn"].Value <string>();
     }
     if (node["crmIdIn"] != null)
     {
         this._CrmIdIn = node["crmIdIn"].Value <string>();
     }
     if (node["playlistIdIn"] != null)
     {
         this._PlaylistIdIn = node["playlistIdIn"].Value <string>();
     }
     if (node["domainIn"] != null)
     {
         this._DomainIn = node["domainIn"].Value <string>();
     }
     if (node["canonicalUrlIn"] != null)
     {
         this._CanonicalUrlIn = node["canonicalUrlIn"].Value <string>();
     }
 }
 public DateInformation(DateTime startDate, ReportInterval interval)
 {
     StartDate = startDate;
     Interval  = interval;
 }
        public async Task <IActionResult> GetSpentHours(ReportInterval interval)
        {
            var hours = await _automationService.GetSpentHours(interval);

            return(Ok(hours));
        }