Ejemplo n.º 1
0
        private static Project CalculateBotProject(int iterationsCount, Project botProject)
        {
            var calculator = IoC.Resolve <ProgressCalculator>();

            for (int i = 0; i < iterationsCount; i++)
            {
                if (botProject.Webshops.Any())
                {
                    var webshop       = botProject.Webshops.First();
                    var availableTime = BusinessConstants.DefaultDeveloperCapacity * 2;

                    while (webshop.Features.Sum(f => f.RemainingImplementationRequirements) < availableTime)
                    {
                        var implementedIds = webshop.Features.Select(f => f.Definition.Id).ToList();
                        var nextFeature    = BotHelper.GetSortedFeaturesForBot().FirstOrDefault(f => !implementedIds.Contains(f.Id));

                        if (nextFeature == null)
                        {
                            break;
                        }

                        var nextWebshopFeature = new WebshopFeature()
                        {
                            Id = Guid.NewGuid(),
                            AddedOnIteration = i,
                            Definition       = nextFeature,
                            WebshopId        = webshop.Id,
                            RemainingImplementationRequirements = nextFeature.ImplementationRequirements
                        };

                        webshop.Features = webshop.Features.Concat(new[] { nextWebshopFeature }).ToList();
                    }
                }

                botProject = calculator.CalculateNextIteration(botProject, i);
            }

            return(botProject);
        }
Ejemplo n.º 2
0
        public static Project GetCalculatedBotProject(Project project, int iterationsCount)
        {
            var botProject = BotHelper.CreateBotProject(project);

            return(BotHelper.CalculateBotProject(iterationsCount, botProject));
        }