예제 #1
0
        private void AppendValidatedPackages(List <ValidatedPackageViewModel> validatedPackages, IEnumerable <PackageValidationSet> validationSets, ValidatingType validatingType)
        {
            var groups = validationSets
                         .Where(x => x.ValidatingType == validatingType)
                         .OrderBy(x => x.PackageId)
                         .ThenByDescending(x => NuGetVersion.Parse(x.PackageNormalizedVersion))
                         .ThenByDescending(x => x.PackageKey)
                         .ThenByDescending(x => x.Created)
                         .ThenByDescending(x => x.Key)
                         .GroupBy(x => x.PackageKey);

            foreach (var group in groups)
            {
                foreach (var set in group)
                {
                    // Put completed validations first then put new validations on top.
                    set.PackageValidations = set.PackageValidations
                                             .OrderByDescending(x => x.ValidationStatus)
                                             .ThenByDescending(x => x.ValidationStatusTimestamp)
                                             .ToList();
                }
                var deletedStatus    = _validationAdminService.GetDeletedStatus(group.Key, validatingType);
                var validatedPackage = new ValidatedPackageViewModel(group.ToList(), deletedStatus, validatingType);
                validatedPackages.Add(validatedPackage);
            }
        }
        private void AppendNuGetPackageValidations(
            List <NuGetPackageValidationViewModel> packageValidations,
            IEnumerable <PackageValidationSet> validationSets,
            ValidatingType validatingType)
        {
            var groups = validationSets
                         .Where(x => x.ValidatingType == validatingType)
                         .OrderBy(x => x.PackageId, StringComparer.OrdinalIgnoreCase)
                         .ThenByDescending(x => NuGetVersion.Parse(x.PackageNormalizedVersion))
                         .ThenByDescending(x => x.PackageKey)
                         .ThenByDescending(x => x.Created)
                         .ThenByDescending(x => x.Key)
                         .GroupBy(x => x.PackageKey);

            foreach (var group in groups)
            {
                foreach (var set in group)
                {
                    set.PackageValidations = set.PackageValidations
                                             .OrderBy(x => x.Started)
                                             .ToList();
                }
                var deletedStatus     = _validationAdminService.GetDeletedStatus(group.Key.Value, validatingType);
                var packageValidation = new NuGetPackageValidationViewModel(group.ToList(), deletedStatus, validatingType);
                packageValidations.Add(packageValidation);
            }
        }