Exemple #1
0
        public DomainStatProjectState GetProjectState(string projectId)
        {
            List <StatProjectStateV3Entity> projectStates = _projectStateRepostitory.AsEnumerable(p => p.ProjectId == projectId).ToList();

            bool isCic = projectStates.All(p => p.Producer == ProductName.CicIPad ||
                                           p.Producer == ProductName.CicMac ||
                                           p.Producer == ProductName.CicPc);

            bool isSuccessfulUpload = isCic
                ? projectStates.Select(p => p.ActionType).ContainsAll(new[] { StatActionType.Project, StatActionType.Avsx, StatActionType.Video })
                : projectStates.Select(p => p.ActionType).ContainsAll(new[] { StatActionType.Project, StatActionType.Avsx, StatActionType.Video, StatActionType.Screenshot });

            StatProjectStateV3Entity entity = projectStates.FirstOrDefault(p => p.ActionType == StatActionType.Project) ?? new StatProjectStateV3Entity {
                ProjectId = projectId
            };

            DomainStatProjectState domain = _statMapper.StatProjectStateToDomain(entity, isSuccessfulUpload);

            return(domain);
        }