Esempio n. 1
0
        public void TrackIssueProgress(Issue issue, IssueProgressType type)
        {
            var lastChange = (from x in IssueProgresses
                              where x.IssueId == issue.Id
                              orderby x.Date descending
                              select x).FirstOrDefault();

            int storyPoints;

            if (lastChange != null)
            {
                switch (lastChange.State)
                {
                    case ScheduleState.Defined:
                        switch (issue.State)
                        {
                            case ScheduleState.Done:
                                storyPoints = (-1) * issue.StoryPoints;
                                break;
                            default:
                                return;
                        }
                        break;
                    case ScheduleState.InProgress:
                        switch (issue.State)
                        {
                            case ScheduleState.Done:
                                storyPoints = (-1) * issue.StoryPoints;
                                break;
                            default:
                                return;
                        }
                        break;
                    case ScheduleState.Done:
                        switch (issue.State)
                        {
                            case ScheduleState.InProgress:
                                storyPoints = issue.StoryPoints;
                                break;
                            case ScheduleState.Defined:
                                storyPoints = issue.StoryPoints;
                                break;
                            default:
                                return;
                        }
                        break;
                    default:
                        return;
                }
            }
            else
            {
                storyPoints = issue.StoryPoints;
            }

            var change = new IssueProgress
            {
                IssueId = issue.Id,
                IterationId = issue.IterationId,
                ProjectId = issue.ProjectId,
                ReleaseId = issue.ReleaseId,
                State = issue.State,
                StoryPoints = storyPoints,
                AssigneeId = issue.AssigneeId,
                Date = DateTime.UtcNow,
                Type = type
            };

            Database.IssueProgresses.Add(change);
        }
Esempio n. 2
0
 public void TrackIssueProgress(IEnumerable<Issue> issues, IssueProgressType type)
 {
     foreach (var issue in issues)
     {
         TrackIssueProgress(issue, type);
     }
 }