コード例 #1
0
ファイル: CardsAggregator.cs プロジェクト: maracuda/Treller
        public CardsAggregationModel Aggregate(BoardList doneList, BoardList additionalDoneList = null)
        {
            if (additionalDoneList != null && !string.Equals(doneList.BoardId, additionalDoneList.BoardId))
            {
                throw new ArgumentException($"Both lists should be from single board! Observed boards ids: {doneList.BoardId}, {additionalDoneList.BoardId}.");
            }

            var additionalDoneListId = additionalDoneList?.Id;
            var cardIds = taskManagerClient.GetBoardLists(doneList.BoardId).Where(x => x.Id.Equals(doneList.Id) || (additionalDoneListId != null && x.Id.Equals(additionalDoneListId)))
                          .Select(l => l.Cards.Select(c => c.Id))
                          .SelectMany(i => i)
                          .ToArray();

            return(CardsAggregationModel.Create(cardIds.Select(cardId => cardStatsBuilder.Build(cardId)).ToArray()));
        }
コード例 #2
0
        private static IList <ReportRow> Build(CardsAggregationModel cardsAggregation, string[] listNames, Dictionary <string, string> listNameToIdIndex)
        {
            var rowsList = new List <ReportRow> {
                BuildHeader(listNames)
            };

            foreach (var cardStats in cardsAggregation.CardsStats)
            {
                rowsList.Add(BuildCardStats(cardStats, listNames, listNameToIdIndex));
            }
            rowsList.Add(ReportRow.Empty);
            rowsList.AddRange(BuildAgregationStats("Full aggregation stats", cardsAggregation.FullAggregationStats));
            rowsList.AddRange(BuildAgregationStats("S tasks aggregation stats", cardsAggregation.SAggregationStats));
            rowsList.AddRange(BuildAgregationStats("M tasks aggregation stats", cardsAggregation.MAggregationStats));
            rowsList.AddRange(BuildAgregationStats("L tasks aggregation stats", cardsAggregation.LAggregationStats));
            rowsList.AddRange(BuildAgregationStats("XL tasks aggregation stats", cardsAggregation.XLAggregationStats));

            return(rowsList);
        }