Exemplo n.º 1
0
        public MemberPerformance GetMemberPerformance(string memberUId)
        {
            MemberPerformance memberPerformance = new ScrumFactory.MemberPerformance()
            {
                MemberUId = memberUId
            };

            System.DateTime today     = System.DateTime.Today;
            int             thisYear  = today.Year;
            int             thisMonth = today.Month;

            using (var context = new ScrumFactoryEntities(this.connectionString)) {
                IQueryable <Task> doneTasks          = context.Tasks.Where(t => t.TaskAssigneeUId == memberUId && t.Status == 2);
                IQueryable <Task> doneTasksThisMonth = doneTasks.Where(t => t.EndDate != null && t.EndDate.Value.Year == thisYear && t.EndDate.Value.Month == thisMonth);

                memberPerformance.TasksDone = doneTasks.Count();

                decimal?hours = doneTasks.Sum(t => (decimal?)t.EffectiveHours);
                memberPerformance.TotalWorkedHours = hours.HasValue ? hours.Value : 0;

                memberPerformance.BugsResolved     = doneTasksThisMonth.Count(t => t.TaskType == 4);
                memberPerformance.ImprovimentsDone = doneTasksThisMonth.Count(t => t.TaskType == 0);

                memberPerformance.TasksDoneBeforePlanned = doneTasksThisMonth.Count(t => t.EffectiveHours < t.PlannedHours);

                decimal?monthHours = doneTasksThisMonth.Sum(t => (decimal?)t.EffectiveHours);
                memberPerformance.MonthWorkedHours = monthHours.HasValue ? monthHours.Value : 0;
            }

            return(memberPerformance);
        }
Exemplo n.º 2
0
        public MemberPerformance GetMemberPerformance(string memberUId)
        {
            MemberPerformance memberPerformance = new ScrumFactory.MemberPerformance() { MemberUId = memberUId };
            System.DateTime today = System.DateTime.Today;
            int thisYear = today.Year;
            int thisMonth = today.Month;
            using (var context = new ScrumFactoryEntities(this.connectionString)) {

                IQueryable<Task> doneTasks = context.Tasks.Where(t => t.TaskAssigneeUId == memberUId && t.Status == 2);
                IQueryable<Task> doneTasksThisMonth = doneTasks.Where(t=> t.EndDate!=null && t.EndDate.Value.Year==thisYear && t.EndDate.Value.Month==thisMonth);

                memberPerformance.TasksDone = doneTasks.Count();

                decimal? hours = doneTasks.Sum(t => (decimal?)t.EffectiveHours);
                memberPerformance.TotalWorkedHours = hours.HasValue ? hours.Value : 0;

                memberPerformance.BugsResolved = doneTasksThisMonth.Count(t => t.TaskType == 4);
                memberPerformance.ImprovimentsDone = doneTasksThisMonth.Count(t => t.TaskType == 0);

                memberPerformance.TasksDoneBeforePlanned = doneTasksThisMonth.Count(t => t.EffectiveHours < t.PlannedHours);

                decimal? monthHours = doneTasksThisMonth.Sum(t => (decimal?)t.EffectiveHours);
                memberPerformance.MonthWorkedHours = monthHours.HasValue ? monthHours.Value : 0;
            }

            return memberPerformance;
        }