예제 #1
0
        public IList <GroupedStatistic> GroupBy(GroupingArgs args)
        {
            if (groupingService.GroupBy == args.Method)
            {
                return(groupingService.Group(args.Commits, args.From, args.To));
            }

            var statistic = new StatisticCalculationHelper(args.Commits).Calculte();

            return(new List <GroupedStatistic> {
                new GroupedStatistic(statistic, args.From, args.To)
            });
        }
예제 #2
0
        public string GetDateDifStatistic(Command.Infrastructure.Models.Command command)
        {
            var args        = command.Args.Split(' ').Select(x => x.Trim()).ToList();
            var stringDates = args.Take(2).ToArray();
            var statistic   = storage.Get();

            if (CheckArgs(stringDates, statistic) != null)
            {
                return(CheckArgs(stringDates, statistic));
            }

            var dates         = ParseDates(stringDates);
            var actualCommits = statistic.Commits
                                .Where(x => x.Date.Date >= dates[0] && x.Date.Date <= dates[1])
                                .ToList();
            var groupingArguments = new GroupingArgs(actualCommits, GetMethod(args), dates[0], dates[1]);
            var groups            = groupingFactory.GroupBy(groupingArguments);

            return(BuildReport(groups));
        }