public EmployeeCollectionStatus GetStatus(IEnumerable <Employee> employees, Domain.Entity.LearningCalendar.Topic topic)
        {
            var collectionStatus = new EmployeeCollectionStatus();

            foreach (Employee employee in employees)
            {
                var employeeStatus = _employeeTopicProgressStatusStrategy.GetStatus(employee, topic);
                switch (employeeStatus)
                {
                case Status.NotPlanned:
                    collectionStatus.OtherEmployees.Add(employee);
                    break;

                case Status.Planned:
                    collectionStatus.PlannedEmployees.Add(employee);
                    break;

                case Status.Learned:
                    collectionStatus.LearnedEmployees.Add(employee);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            AddTotalStatus(collectionStatus);

            return(collectionStatus);
        }
Beispiel #2
0
     private GetSubordinateTopicTreeOperationResponse.Status MapStatus(EmployeeCollectionStatus status)
     {
         GetSubordinateTopicTreeOperationResponse.Status mappedStatus = status.TotalStatus switch
         {
             Status.NotPlanned => GetSubordinateTopicTreeOperationResponse.Status.NotPlanned,
             Status.Planned => GetSubordinateTopicTreeOperationResponse.Status.Planned,
             Status.Learned => GetSubordinateTopicTreeOperationResponse.Status.Learned,
             _ => throw new ArgumentOutOfRangeException()
         };
         return(mappedStatus);
     }
 }
        private void AddTotalStatus(EmployeeCollectionStatus collectionStatus)
        {
            bool planning    = collectionStatus.PlannedEmployees.Any();
            bool learned     = collectionStatus.LearnedEmployees.Any();
            bool notPlanning = collectionStatus.OtherEmployees.Any();

            collectionStatus.TotalStatus =
                (learned, planning, notPlanning) switch
            {
                (_, true, _) => Status.Planned,
                (false, false, _) => Status.NotPlanned,
                (true, false, false) => Status.Learned,
                (true, false, true) => Status.NotPlanned
            };