/// <summary> /// determines the number of reps associated with each set in the exercise in the workout /// </summary> private List <WorkoutItem> CalculateReps(List <WorkoutItem> items) { items.ForEach(item => { int numSets = item.sets.Count(); List <int> style = SelectStyle(numSets); for (int i = 0; i < item.sets.Count(); i++) { WorkoutSet set = item.sets[i]; set.reps = style[i]; item.sets[i] = set; } }); return(items); }
/// <summary> /// determines the percentage of one rep max for each set in the workout /// </summary> private List <WorkoutItem> CalculateIntensity(List <WorkoutItem> items, List <BodyPart> partsList) { Dictionary <BodyPart, int> numSetsByBodyPart = new Dictionary <BodyPart, volume>(); partsList.ForEach(part => numSetsByBodyPart.Add(part, 0)); items.ForEach(item => numSetsByBodyPart[item.ex.mainBodyPart] += item.sets.Count()); Dictionary <BodyPart, int> bodyPartSetProgress = new Dictionary <BodyPart, volume>(); partsList.ForEach(part => bodyPartSetProgress.Add(part, 0)); for (int i = 0; i < items.Count(); i++) { for (int j = 0; j < items[i].sets.Count(); j++) { BodyPart bodyPart = items[i].ex.mainBodyPart; bodyPartSetProgress[bodyPart] += 1; WorkoutSet set = items[i].sets[j]; set.percent1RM = CalculatePercentOfMax(items[i].sets.Count(), j, set.reps, numSetsByBodyPart[bodyPart], bodyPartSetProgress[bodyPart]); } } //use this as the base Util.repsMaxPercent1RM() and then look at location in workout and exercise style return(items); }