예제 #1
0
        private (Status, BacklogEvalQueryResult) EvalSubmissions(string backlogId)
        {
            var(status, submissions) = _backlogrepo.ReadSubmissions(backlogId);
            if (status is Failure)
            {
                return(status, null);
            }

            int[] currentOrder = _totalorder.Order(submissions);

            var(status2, backlog) = _backlogrepo.ReadBacklog(backlogId);
            if (status2 is Failure)
            {
                return(status2, null);
            }

            return(new Success(), new BacklogEvalQueryResult
            {
                Id = backlogId,
                Title = backlog.Title,
                UserStories = applyOrder(backlog.UserStories, currentOrder),
                NumberOfSubmissions = submissions.Length,
                OneVotePerUser = backlog.OneVotePerUser
            });
        }
예제 #2
0
        public Status HandleBacklogsShowRequest()
        {
            try
            {
                var backlogs     = _backlogrepo.GetAll();
                var displayItems = backlogs.Select(Transform);
                return(new Success <BacklogShowQueryResult>(new BacklogShowQueryResult(displayItems)));
            }
            catch (Exception)
            {
                return(new Failure());
            }

            BacklogShowQueryResult.BacklogDisplayItem Transform(Backlog backlog)
            {
                var submissions = _backlogrepo.ReadSubmissions(backlog.Id);

                return(BacklogShowQueryResult.BacklogDisplayItem.FromBacklog(backlog, submissions));
            }
        }