private float?GetEffort(EffortType effortType, FieldsB fieldsB) { float?effort; switch (effortType) { case EffortType.Effort: effort = fieldsB.MicrosoftVSTSSchedulingEffort; break; case EffortType.StoryPoints: effort = fieldsB.MicrosoftVSTSSchedulingStoryPoints; break; case EffortType.Size: effort = fieldsB.MicrosoftVSTSSchedulingSize; break; default: effort = GetDefaultEffort(fieldsB); break; } return(effort); }
public void SafeAddEffort(EffortType type, int val) { var oldVal = GetEffort(type); if (oldVal > GetMaxEffort(type)) { return; } SetEffort(type, Mathf.Min(GetMaxEffort(type), oldVal + val)); }
private async Task LoopThruSprintDays(SprintProgressDto sprintProgressDto, EffortType effortType) { //loop thru each of the 10 sprint days for (var sprintDateWithoutTime = sprintProgressDto.SprintStart; sprintDateWithoutTime <= sprintProgressDto.SprintEnd; sprintDateWithoutTime = sprintDateWithoutTime.AddDays(1)) { if (IsWeekday(sprintDateWithoutTime)) { await PopulateSprintProgressDto(sprintProgressDto, effortType, sprintDateWithoutTime); } } }
private WorkItemDto GetWorkItemDto(EffortType effortType, DateTime sprintDateWithTime, ValueB valueB) { var effort = GetEffort(effortType, valueB.fieldsB); var workItemDto = new WorkItemDto { AsOf = sprintDateWithTime, Effort = effort, Id = valueB.id, State = valueB.fieldsB.SystemState }; return(workItemDto); }
public int GetEffort(EffortType type) { switch (type) { case EffortType.Physical: return(Physical); case EffortType.Mental: return(Mental); case EffortType.Social: return(Social); } throw new System.Exception("Effort type doesn't exist"); }
public void SetEffort(EffortType type, int val) { switch (type) { case EffortType.Physical: Physical = val; break; case EffortType.Mental: Mental = val; break; case EffortType.Social: Social = val; break; } }
public void Load(MySqlDataReader dr) { Setup(); SetId(Convert.ToInt32(dr["Id"])); _extId = Convert.ToInt32(dr["extId"]); this._effId = new EffortID(dr["type"].ToString() + _extId); _testedBy = Convert.ToString(dr["testedBy"]); _approved = Convert.ToBoolean(dr["approved"]); _pmResource = Convert.ToString(dr["pmResource"]); _webResource = Convert.ToString(dr["webResource"]); _dbResource = Convert.ToString(dr["dbResource"]); _uatApproved = Convert.ToBoolean(dr["uatApproved"]); _projectManager = Convert.ToString(dr["pmResource"]); _maxResource = Convert.ToString(dr["maxResource"]); _uatApprovedBy = Convert.ToString(dr["uatApprovedBy"]); _branchFileHierarchy = Convert.ToString(dr["branchFileHierarchy"]); _environment = Convert.ToString(dr["environment"]); if (Convert.ToChar(dr["type"]) == 'P') _effType = EffortType.Project; if (Convert.ToChar(dr["type"]) == 'T') _effType = EffortType.Ticket; this._desc = Convert.ToString(dr["desc_"]); _requester = Convert.ToString(dr["requestor"]); MarkOld(); }
private async Task PopulateSprintProgressDto(SprintProgressDto sprintProgressDto, EffortType effortType, DateTime sprintDateWithTime, string sprintDateYMDTHMSMSZ, List <Workitem> workItemsInSprintOnSprintDate) { if (workItemsInSprintOnSprintDate == null || workItemsInSprintOnSprintDate.Count == 0) { //handle zero work items on day zero/one of the sprint (or on dates in the future) as the first (aka "zeroth") day of sprint seems to return zero work items e.g. if sprint starts on 10th Jan var workItemDto = new WorkItemDto { AsOf = sprintDateWithTime }; InitialiseWorkItemDtos(sprintProgressDto); sprintProgressDto.WorkItemDtos.Add(workItemDto); } else { var valueBs = await GetValueBsFromWorkitems(sprintDateYMDTHMSMSZ, workItemsInSprintOnSprintDate); InitialiseWorkItemDtos(sprintProgressDto); foreach (var valueB in valueBs) { var workItemDto = GetWorkItemDto(effortType, sprintDateWithTime, valueB); sprintProgressDto.WorkItemDtos.Add(workItemDto); } } }
private async Task PopulateSprintProgressDto(SprintProgressDto sprintProgressDto, EffortType effortType, DateTime sprintDateWithoutTime) { var sprintDateWithTime = GetSprintDateWithTime(sprintDateWithoutTime); //get work item ids (json response) in the sprint on this specific date var workItemJson = await GetWorkItemData(sprintDateWithTime); //set up date format var sprintDateYMDTHMSMSZ = GetFormattedDate(sprintDateWithTime); //deserialize to a list of ids/urls for that date var workItemsInSprintOnSprintDate = _workItemProcessor.GetWorkItemsByJson(workItemJson).ToList(); await PopulateSprintProgressDto(sprintProgressDto, effortType, sprintDateWithTime, sprintDateYMDTHMSMSZ, workItemsInSprintOnSprintDate); }
public void SafeSubtractEffort(EffortType type, int val) { var oldVal = GetEffort(type); SetEffort(type, Mathf.Max(0, oldVal - val)); }
static void Main(string[] args) { var sessionFactory = Fluently.Configure() .Database(MsSqlConfiguration.MsSql2008.ConnectionString(x => x.FromConnectionStringWithKey("IndoorWorx"))) .Mappings(x => x.FluentMappings.AddFromAssemblyOf <Module>()) .ExposeConfiguration(x => new SchemaExport(x).SetOutputFile("../../Schema/createdb.sql").Create(true, true)) .BuildSessionFactory(); using (var session = sessionFactory.OpenSession()) { using (var transaction = session.BeginTransaction()) { session.Save(new ApplicationUser() { Email = "*****@*****.**", Firstname = "Ross", Gender = Genders.Male, Lastname = "McEwan", Username = "******", Credits = 100 }); var power = new EffortType() { Title = "Power", Sequence = 10, Tag = "POWER" }; session.Save(power); var hr = new EffortType() { Title = "Heart Rate", Sequence = 20, Tag = "HR" }; session.Save(hr); var rpe = new EffortType() { Title = "RPE", Description = "Rate of perceived exertion", Sequence = 30, Tag = "RPE" }; session.Save(rpe); var l1 = new IntervalLevel() { Title = "L1 - Active Recovery", Sequence = 10, MaximumPercentageOfFthr = 68, MaximumPercentageOfFtp = 55, MinRPE = 0, MaxRPE = 2 }; session.Save(l1); var l2 = new IntervalLevel() { Title = "L2 - Endurance", Sequence = 20, MinimumPercentageOfFthr = 69, MaximumPercentageOfFthr = 83, MaximumPercentageOfFtp = 75, MinimumPercentageOfFtp = 56, MinRPE = 2, MaxRPE = 3 }; session.Save(l2); var l3 = new IntervalLevel() { Title = "L3 - Tempo", Sequence = 30, MinimumPercentageOfFthr = 84, MaximumPercentageOfFthr = 94, MaximumPercentageOfFtp = 90, MinimumPercentageOfFtp = 76, MinRPE = 3, MaxRPE = 4 }; session.Save(l3); var l4 = new IntervalLevel() { Title = "L4 - Lactate Threshold", Sequence = 40, MinimumPercentageOfFthr = 95, MaximumPercentageOfFthr = 105, MaximumPercentageOfFtp = 105, MinimumPercentageOfFtp = 91, MinRPE = 4, MaxRPE = 5, TypicalMinDuration = TimeSpan.FromMinutes(8), TypicalMaxDuration = TimeSpan.FromMinutes(30) }; session.Save(l4); var l5 = new IntervalLevel() { Title = "L5 - VO2max", Sequence = 50, MinimumPercentageOfFthr = 106, MaximumPercentageOfFtp = 120, MinimumPercentageOfFtp = 106, MinRPE = 6, MaxRPE = 7, TypicalMinDuration = TimeSpan.FromMinutes(3), TypicalMaxDuration = TimeSpan.FromMinutes(8) }; session.Save(l5); var l6 = new IntervalLevel() { Title = "L6 - Anaerobic Capacity", Sequence = 60, MaximumPercentageOfFtp = 150, MinimumPercentageOfFtp = 121, MinRPE = 7, TypicalMinDuration = TimeSpan.FromSeconds(30), TypicalMaxDuration = TimeSpan.FromMinutes(3) }; session.Save(l6); var l7 = new IntervalLevel() { Title = "L7 - Neuromuscular Power", Sequence = 70, TypicalMaxDuration = TimeSpan.FromSeconds(30) }; session.Save(l7); //var warmup = new IntervalType() { Name = "Warm up", Tag = "WARMUP", Sequence = 10 }; //session.Save(warmup); //var cooldown = new IntervalType() { Name = "Cool down", Tag = "COOLDOWN", Sequence = 20 }; //session.Save(cooldown); //var recover = new IntervalType() { Name = "Recovery", Tag = "RECOVERY", Sequence = 30 }; //session.Save(recover); //var longHills = new IntervalType() { Name = "Long Hills", Tag = "LONGHILLS", Sequence = 40 }; //session.Save(longHills); //var shortHills = new IntervalType() { Name = "Short Hills", Tag = "SHORTHILLS", Sequence = 50 }; //session.Save(shortHills); //var tt = new IntervalType() { Name = "Time Trial", Tag = "TIMETRIAL", Sequence = 60 }; //session.Save(tt); //var sprints = new IntervalType() { Name = "Sprints", Tag = "SPRINTS", Sequence = 70 }; //session.Save(sprints); //var breakaways = new IntervalType() { Name = "Breakaways", Tag = "BREAKAWAYS", Sequence = 80 }; //session.Save(breakaways); var levels = new IntervalType() { Name = "Levels", Sequence = 10, Tag = IntervalType.LevelsTag }; session.Save(levels); var stepped = new IntervalType() { Name = "Stepped", Sequence = 20, Tag = IntervalType.SteppedTag }; session.Save(stepped); var recover = new IntervalType() { Name = "Recovery", Tag = IntervalType.RecoveryTag, Sequence = 30 }; session.Save(recover); #region 4x10 var trainingTemplate = new TrainingSetTemplate(); trainingTemplate.IsPublic = true; trainingTemplate.EffortType = power; trainingTemplate.Duration = TimeSpan.FromMinutes(70); trainingTemplate.Title = "4 x 10"; trainingTemplate.Description = "An easy 10 minute warm up followed by 4 10 minute intervals at threshold with 5 minutes recovery. This is followed by an easy 5 minute cool down."; trainingTemplate.Intervals.Add(new Interval() { Title = "Warm up", TemplateSection = "WARMUP", SectionGroup = "W1", IntervalType = levels, IntervalLevel = l1, Duration = TimeSpan.FromMinutes(10), EffortType = power, Effort = (l1.MinimumPercentageOfFtp + l1.MaximumPercentageOfFtp) / 2, Sequence = 0 }); trainingTemplate.Intervals.Add(new Interval() { Title = "Interval #1", TemplateSection = "MAINSET", SectionGroup = "M1", IntervalType = levels, IntervalLevel = l3, Duration = TimeSpan.FromMinutes(10), EffortType = power, Effort = (l3.MinimumPercentageOfFtp + l3.MaximumPercentageOfFtp) / 2, Sequence = 1 }); trainingTemplate.Intervals.Add(new Interval() { Title = "Recovery", TemplateSection = "MAINSET", SectionGroup = "M1", IntervalType = levels, IntervalLevel = l1, Duration = TimeSpan.FromMinutes(5), EffortType = power, Effort = (l1.MinimumPercentageOfFtp + l1.MaximumPercentageOfFtp) / 2, Sequence = 2 }); trainingTemplate.Intervals.Add(new Interval() { Title = "Interval #2", TemplateSection = "MAINSET", SectionGroup = "M1", IntervalType = levels, IntervalLevel = l3, Duration = TimeSpan.FromMinutes(10), EffortType = power, Effort = (l3.MinimumPercentageOfFtp + l3.MaximumPercentageOfFtp) / 2, Sequence = 3 }); trainingTemplate.Intervals.Add(new Interval() { Title = "Recovery", TemplateSection = "MAINSET", SectionGroup = "M1", IntervalType = levels, IntervalLevel = l1, Duration = TimeSpan.FromMinutes(5), EffortType = power, Effort = (l1.MinimumPercentageOfFtp + l1.MaximumPercentageOfFtp) / 2, Sequence = 4 }); trainingTemplate.Intervals.Add(new Interval() { Title = "Interval #3", TemplateSection = "MAINSET", SectionGroup = "M1", IntervalType = levels, IntervalLevel = l3, Duration = TimeSpan.FromMinutes(10), EffortType = power, Effort = (l3.MinimumPercentageOfFtp + l3.MaximumPercentageOfFtp) / 2, Sequence = 5 }); trainingTemplate.Intervals.Add(new Interval() { Title = "Recovery", TemplateSection = "MAINSET", SectionGroup = "M1", IntervalType = levels, IntervalLevel = l1, Duration = TimeSpan.FromMinutes(5), EffortType = power, Effort = (l1.MinimumPercentageOfFtp + l1.MaximumPercentageOfFtp) / 2, Sequence = 6 }); trainingTemplate.Intervals.Add(new Interval() { Title = "Interval #4", TemplateSection = "MAINSET", SectionGroup = "M1", IntervalType = levels, IntervalLevel = l3, Duration = TimeSpan.FromMinutes(10), EffortType = power, Effort = (l3.MinimumPercentageOfFtp + l3.MaximumPercentageOfFtp) / 2, Sequence = 7 }); trainingTemplate.Intervals.Add(new Interval() { Title = "Recovery", TemplateSection = "MAINSET", SectionGroup = "M1", IntervalType = levels, IntervalLevel = l1, Duration = TimeSpan.FromMinutes(5), EffortType = power, Effort = (l1.MinimumPercentageOfFtp + l1.MaximumPercentageOfFtp) / 2, Sequence = 8 }); trainingTemplate.Intervals.Add(new Interval() { Title = "Cool down", TemplateSection = "COOLDOWN", SectionGroup = "C1", IntervalType = levels, IntervalLevel = l1, Duration = TimeSpan.FromMinutes(5), EffortType = power, Effort = (l1.MinimumPercentageOfFtp + l1.MaximumPercentageOfFtp) / 2, Sequence = 9 }); session.Save(trainingTemplate); #endregion #region 2x20 var trainingTemplate1 = new TrainingSetTemplate(); trainingTemplate1.IsPublic = true; trainingTemplate1.EffortType = power; trainingTemplate1.Duration = TimeSpan.FromHours(1); trainingTemplate1.Title = "2 x 20"; trainingTemplate1.Description = "An easy 10 minute warm up followed by 2 20 minute intervals at threshold with 5 minutes recovery. This is followed by an easy 5 minute cool down."; trainingTemplate1.Intervals.Add(new Interval() { Title = "Warm up", TemplateSection = "WARMUP", SectionGroup = "W1", IntervalType = levels, IntervalLevel = l1, Duration = TimeSpan.FromMinutes(10), EffortType = power, Effort = (l1.MinimumPercentageOfFtp + l1.MaximumPercentageOfFtp) / 2, Sequence = 0 }); trainingTemplate1.Intervals.Add(new Interval() { Title = "Interval #1", TemplateSection = "MAINSET", SectionGroup = "M1", IntervalType = levels, IntervalLevel = l3, Duration = TimeSpan.FromMinutes(20), EffortType = power, Effort = (l3.MinimumPercentageOfFtp + l3.MaximumPercentageOfFtp) / 2, Sequence = 1 }); trainingTemplate1.Intervals.Add(new Interval() { Title = "Recovery", IntervalType = levels, TemplateSection = "MAINSET", SectionGroup = "M1", IntervalLevel = l1, Duration = TimeSpan.FromMinutes(5), EffortType = power, Effort = (l1.MinimumPercentageOfFtp + l1.MaximumPercentageOfFtp) / 2, Sequence = 2 }); trainingTemplate1.Intervals.Add(new Interval() { Title = "Interval #2", IntervalType = levels, TemplateSection = "MAINSET", SectionGroup = "M1", IntervalLevel = l3, Duration = TimeSpan.FromMinutes(20), EffortType = power, Effort = (l3.MinimumPercentageOfFtp + l3.MaximumPercentageOfFtp) / 2, Sequence = 3 }); trainingTemplate1.Intervals.Add(new Interval() { Title = "Recovery", IntervalType = levels, TemplateSection = "MAINSET", SectionGroup = "M1", IntervalLevel = l1, Duration = TimeSpan.FromMinutes(5), EffortType = power, Effort = (l1.MinimumPercentageOfFtp + l1.MaximumPercentageOfFtp) / 2, Sequence = 4 }); trainingTemplate1.Intervals.Add(new Interval() { Title = "Cool down", TemplateSection = "COOLDOWN", SectionGroup = "C1", IntervalType = levels, IntervalLevel = l1, Duration = TimeSpan.FromMinutes(5), EffortType = power, Effort = (l1.MinimumPercentageOfFtp + l1.MaximumPercentageOfFtp) / 2, Sequence = 5 }); session.Save(trainingTemplate1); #endregion session.Save(new Category() { Title = "ALL", Sequence = 0, CatalogUri = new Uri("/IndoorWorx.Catalog.Silverlight;component/Pages/VideoCatalogPage.xaml?filter=ALL&orderBy=CATEGORY", UriKind.RelativeOrAbsolute), LibraryUri = new Uri("/IndoorWorx.MyLibrary.Silverlight;component/Pages/VideoCatalogPage.xaml?filter=ALL&orderBy=CATEGORY", UriKind.RelativeOrAbsolute) }); session.Save(BuildRidesCategory()); session.Save(BuildSnippetsCategory()); session.Save(new Category() { Title = "WORKOUTS", Sequence = 3, CatalogUri = new Uri("/IndoorWorx.Catalog.Silverlight;component/Pages/VideoCatalogPage.xaml?filter=WORKOUTS&orderBy=CATEGORY", UriKind.RelativeOrAbsolute), LibraryUri = new Uri("/IndoorWorx.MyLibrary.Silverlight;component/Pages/VideoCatalogPage.xaml?filter=WORKOUTS&orderBy=CATEGORY", UriKind.RelativeOrAbsolute) }); transaction.Commit(); } } }