Пример #1
0
        public void MoveToNextColumn(Ticket ticket)
        {
            Guard.ArgumentNotNull(nameof(ticket), ticket);

            if (Backlog.Contains(ticket))
            {
                Move(Backlog, ToDo, ticket);
                return;
            }

            if (ToDo.Contains(ticket))
            {
                Move(ToDo, Test, ticket);
                return;
            }

            if (Test.Contains(ticket))
            {
                Move(Test, Done, ticket);
                return;
            }

            if (Done.Contains(ticket))
            {
                throw new InvalidOperationException("The ticket is in the done column");
            }

            throw new InvalidOperationException("Ticket not found");
        }
Пример #2
0
        /// <summary>
        ///     Worker has finished a task, he push it to done in the TaskManager
        /// </summary>
        /// <param name="task"></param>
        public void SetDone(SymuTask task)
        {
            if (task is null)
            {
                throw new ArgumentNullException(nameof(task));
            }

            if (!task.IsAssigned)
            {
                // Task has been cancelled
                return;
            }

            task.UnAssign();
            var todo       = ToDo.Contains(task);
            var inProgress = InProgress.Contains(task);

            if (todo)
            {
                ToDo.Remove(task);
            }
            else if (inProgress)
            {
                InProgress.Remove(task);
            }
            else
            {
                return;
            }

            task.SetDone();
            if (_debug)
            {
                Done.Add(task);
            }

            // We don't want to track message as Task
            if (task.Parent is Message)
            {
                return;
            }

            if (todo)
            {
                TaskResult.ToDo--;
            }
            else
            {
                TaskResult.InProgress--;
            }

            TaskResult.Done++;
            TaskResult.WeightDone    += task.Weight;
            TaskResult.Incorrectness += (int)task.Incorrectness;
        }
Пример #3
0
        /// <summary>
        ///     CancelBlocker a task :
        ///     remove a task from either To do or in progress
        /// </summary>
        /// <param name="task"></param>
        public void Cancel(SymuTask task)
        {
            if (task == null)
            {
                throw new ArgumentNullException(nameof(task));
            }

            if (!task.IsAssigned)
            {
                return;
            }

            var todo       = ToDo.Contains(task);
            var inProgress = InProgress.Contains(task);

            if (todo)
            {
                ToDo.Remove(task);
            }
            else if (inProgress)
            {
                InProgress.Remove(task);
            }
            else
            {
                return;
            }

            task.Cancel();
            if (_debug)
            {
                Cancelled.Add(task);
            }

            // We don't want to track message as Task
            if (task.Parent is Message)
            {
                return;
            }

            if (todo)
            {
                TaskResult.ToDo--;
            }
            else
            {
                TaskResult.InProgress--;
            }

            TaskResult.Cancelled++;
        }