Exemple #1
0
        /// <summary>
        /// OBSOLETE
        /// </summary>
        /// <param name="ms"></param>
        /// <param name="startDate"></param>
        public static void GetBurnDownData(this RMilestoneStatus ms, DateTime startDate)
        {
            var rep = new ReleaseRepository();
            var result = rep.GetArtefactsProgress(ms.Release.Id);

            // determine amount days till milestone
            var period = new Period { StartDate = startDate, EndDate = ms.Date };
            var workingDays = period.AmountWorkingDays;

            // get progress data for milestone
            var count = 0;
            var totalProgress = result.Where(x => ms.Id == x.MilestoneId).Select(x => new { HoursRemaining = x.HoursRemaining, StatusDate = x.StatusDate, DayNumber = count++ }).ToList().OrderBy(x => x.StatusDate);

            // determine slope of known status data
            var amountDays = totalProgress.Count();
            var avgDays = totalProgress.Select(x => x.DayNumber).Average();
            var avgHours = totalProgress.Select(x => x.HoursRemaining).Average();
            var deviations = totalProgress.Select(x => new { xDeviation = x.DayNumber - avgDays, yDeviation = x.HoursRemaining - avgHours, xDevTimesyDev = (x.DayNumber - avgDays) * (x.HoursRemaining - avgHours), xDevSquare = (x.DayNumber - avgDays) * (x.DayNumber - avgDays) }).ToList();
            // divide SUM( (x - avgX) * (y - avgY) ) by SUM( (x - avgX) * (x - avgX) )
            var slope = deviations.Select(x => x.xDevTimesyDev).Sum() / deviations.Select(x => x.xDevSquare).Sum();

            // determine intercept: avgY = (slope * avgX) + intercept -> intercept = -((slope * avgX) - avgY)
            var intercept = -((slope * avgDays) - avgHours);

            // formula best fitted line: amtHours = slope * amtDays + intercept
        }
Exemple #2
0
        public JsonResult GetReleaseProgress(int phaseid, int milestoneId)
        {
            // get complete progress data per artefact
            var rep = new ReleaseRepository();
            var progress = rep.GetArtefactsProgress(phaseid, milestoneId);

            // get burndown for total
            var msRep = new MilestoneRepository();
            var ms = msRep.GetItemById(milestoneId);

            try
            {
                // TODO: determine startdate by using the Phase startdate to which the Milestone is connected
                var uc = new GetBurndownData(new Milestone { Id = milestoneId, Date = ms.Date, Release = new Release { Id = phaseid } }, DateTime.Now.AddDays(-40));
                var burndown = uc.Execute();

                return this.Json(new { Progress = progress, Burndown = burndown }, JsonRequestBehavior.AllowGet);
            }
            catch (ConditionNotMetException ex)
            {
                HttpContext.Response.StatusDescription = string.Format("A condition has not been met: {0}", ex.Message);
                HttpContext.Response.StatusCode = 400;
                return this.Json(string.Format("A condition has not been met: {0}", ex.Message), JsonRequestBehavior.AllowGet);
            }
            catch (ProcessException ex)
            {
                HttpContext.Response.StatusDescription = string.Format("A use case processing exception has occurred: {0}", ex.Message);
                HttpContext.Response.StatusCode = 400;
                return this.Json(string.Format("A use case processing exception has occurred: {0}", ex.Message), JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                HttpContext.Response.StatusDescription = string.Format("An exception has occurred: {0}", ex.Message);
                HttpContext.Response.StatusCode = 500;
                return this.Json(string.Format("An exception has occurred: {0}", ex.Message), JsonRequestBehavior.AllowGet);
            }
        }
Exemple #3
0
        private static IEnumerable<XYPoint> GetWorkloadHistoryPerDayAndArtefact(this RMilestoneStatus ms, DateTime startDate, int artefactId)
        {
            var rep = new ReleaseRepository();
            var result = rep.GetArtefactsProgress(ms.Release.Id);

            // determine amount days till milestone
            var period = new Period { StartDate = startDate, EndDate = ms.Date };

            return result
                .Where(x => ms.Id == x.MilestoneId && x.ArtefactId == artefactId && period.ListWorkingDays[x.StatusDate.ToDutchString()] != null) // get items for specified milestone with statusdate within specified period
                .GroupBy(m => m.StatusDate.ToDutchString(), coll => coll.HoursRemaining, (key, values) => new { HoursRemaining = values.Sum(), Date = key }) // group by statusdate, elementselector (every statusdate-key returns enumerable of remaining hours), return new type
                .Select(aProgress => new XYPoint { Y = aProgress.HoursRemaining, X = period.ListWorkingDays[aProgress.Date].Number });
        }