Ejemplo n.º 1
0
        void isolationBeforeCompoudCheck(TrainingPlanDay day, TrainingPlanCheckResult result)
        {
            var musleSplit = from e1 in day.Entries
                             join exercise in this.exercisesPack.Values on e1.Exercise.GlobalId equals exercise.GlobalId
                             where pack.Exercises.Contains(e1.Exercise)
                             group e1 by exercise.ExerciseType into g
                             select g;

            foreach (var entriesForMuscle in musleSplit)
            {
                List <TrainingPlanEntry> isolatedExercises = new List <TrainingPlanEntry>();
                foreach (var entry in entriesForMuscle)
                {
                    ExerciseDTO exercise = exercisesPack[entry.Exercise.GlobalId];
                    if (exercise.MechanicsType == MechanicsType.Isolation)
                    {
                        isolatedExercises.Add(entry);
                    }
                    else if (exercise.MechanicsType == MechanicsType.Compound)
                    {
                        foreach (var isolatedExercise in isolatedExercises)
                        {
                            result.AddResult(isolatedExercise, "Split_IsolationExerciseBeforeCompoud", TrainingPlanCheckItemStatus.Information);
                        }
                        isolatedExercises.Clear();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void TestFBW_15_10_5Plan()
        {
            Exercise exercise = new Exercise(Guid.NewGuid());

            exercise.Name     = "exercise 2";
            exercise.Shortcut = "E2";

            TrainingPlan plan = new TrainingPlan();

            plan.Comment      = "15-10-5";
            plan.TrainingType = TrainingType.FBW;
            TrainingPlanDay dayA = new TrainingPlanDay();

            plan.AddDay(dayA);
            TrainingPlanEntry entry = new TrainingPlanEntry();

            entry.Exercise = exercise.Map <ExerciseLightDTO>();
            dayA.Entries.Add(entry);

            TrainingPlanDay dayB = new TrainingPlanDay();

            plan.AddDay(dayB);
            TrainingPlanEntry entry1 = new TrainingPlanEntry();

            entry1.Exercise = exercise.Map <ExerciseLightDTO>();
            dayA.Entries.Add(entry1);
        }
Ejemplo n.º 3
0
        public void TestIsolationExerciseBeforeCompoud()
        {
            TrainingPlan plan = new TrainingPlan();

            plan.RestSeconds  = 60;
            plan.Name         = "name";
            plan.Author       = "author";
            plan.TrainingType = TrainingType.Split;
            var day = new TrainingPlanDay();

            day.Name = "day1";
            plan.AddDay(day);
            TrainingPlanEntry entryIsolated = new TrainingPlanEntry();

            entryIsolated.Exercise = new ExerciseLightDTO()
            {
                GlobalId = new Guid("01C796E2-0119-4F95-9A9A-79F2890DF658")
            };
            day.AddEntry(entryIsolated);
            entryIsolated.Sets.Add(new TrainingPlanSerie(10));
            TrainingPlanEntry entryCompoud = new TrainingPlanEntry();

            entryCompoud.Exercise = new ExerciseLightDTO()
            {
                GlobalId = new Guid("9934E9E3-50DC-4B34-8B67-092084894740")
            };
            day.AddEntry(entryCompoud);
            entryCompoud.Sets.Add(new TrainingPlanSerie(10));

            checkSingle(plan, entryIsolated, TrainingPlanCheckItemStatus.Information, "Split_IsolationExerciseBeforeCompoud");
        }
Ejemplo n.º 4
0
        public void TestDropSetInNotOnlyLastSet()
        {
            TrainingPlan plan = new TrainingPlan();

            plan.RestSeconds  = 60;
            plan.Name         = "name";
            plan.Author       = "author";
            plan.TrainingType = TrainingType.Split;
            var day = new TrainingPlanDay();

            day.Name = "day1";
            plan.AddDay(day);
            TrainingPlanEntry entry = new TrainingPlanEntry();

            entry.Exercise = new ExerciseLightDTO()
            {
                GlobalId = new Guid("9934E9E3-50DC-4B34-8B67-092084894740")
            };
            day.AddEntry(entry);
            entry.Sets.Add(new TrainingPlanSerie(10));
            entry.Sets.Add(new TrainingPlanSerie(10));
            var set1 = new TrainingPlanSerie(10);

            set1.DropSet = Service.V2.Model.DropSetType.IIDropSet;
            entry.Sets.Add(set1);
            var set2 = new TrainingPlanSerie(10);

            set2.DropSet = Service.V2.Model.DropSetType.IIDropSet;
            entry.Sets.Add(set2);

            checkSingle(plan, set1, TrainingPlanCheckItemStatus.Information, "TrainingPlan_DropSetInNotOnlyLastSet");
        }
Ejemplo n.º 5
0
        public void TestDayNameUnique()
        {
            TrainingPlan plan = new TrainingPlan();

            plan.RestSeconds  = 60;
            plan.Name         = "name";
            plan.Author       = "author";
            plan.TrainingType = TrainingType.Split;
            var day1 = new TrainingPlanDay();

            day1.Name = "Day 1";
            plan.AddDay(day1);
            TrainingPlanEntry entry = new TrainingPlanEntry();

            entry.Exercise = new ExerciseLightDTO()
            {
                GlobalId = new Guid("9934E9E3-50DC-4B34-8B67-092084894740")
            };
            day1.AddEntry(entry);
            entry.Sets.Add(new TrainingPlanSerie(10));
            var day2 = new TrainingPlanDay();

            day2.Name = "Day 1";
            plan.AddDay(day2);
            entry          = new TrainingPlanEntry();
            entry.Exercise = new ExerciseLightDTO()
            {
                GlobalId = new Guid("9934E9E3-50DC-4B34-8B67-092084894740")
            };
            day2.AddEntry(entry);
            entry.Sets.Add(new TrainingPlanSerie(10));

            checkSingle(plan, day2, TrainingPlanCheckItemStatus.Error, "TrainingPlan_DaysName_Unique");
        }
Ejemplo n.º 6
0
        public void TestTwoIsolationExerciseBeforeCompoud()
        {
            TrainingPlan plan = new TrainingPlan();

            plan.RestSeconds  = 60;
            plan.Name         = "name";
            plan.Author       = "author";
            plan.TrainingType = TrainingType.Split;
            var day = new TrainingPlanDay();

            day.Name = "day1";
            plan.AddDay(day);
            TrainingPlanEntry entryIsolated = new TrainingPlanEntry();

            entryIsolated.Exercise = new ExerciseLightDTO()
            {
                GlobalId = new Guid("01C796E2-0119-4F95-9A9A-79F2890DF658")
            };
            day.AddEntry(entryIsolated);
            entryIsolated.Sets.Add(new TrainingPlanSerie(10));
            TrainingPlanEntry secondIsolated = new TrainingPlanEntry();

            secondIsolated.Exercise = new ExerciseLightDTO()
            {
                GlobalId = new Guid("D6562C2A-BD74-46BE-8398-57B56BD698D5")
            };
            day.AddEntry(secondIsolated);
            secondIsolated.Sets.Add(new TrainingPlanSerie(10));
            TrainingPlanEntry entryCompoud = new TrainingPlanEntry();

            entryCompoud.Exercise = new ExerciseLightDTO()
            {
                GlobalId = new Guid("9934E9E3-50DC-4B34-8B67-092084894740")
            };
            day.AddEntry(entryCompoud);
            entryCompoud.Sets.Add(new TrainingPlanSerie(10));

            //Dictionary<Guid, ExerciseDTO> exerciseDtos = ObjectsConverter.ToExerciseDTO(exercises.Values).ToDictionary(t => t.GlobalId);
            Dictionary <Guid, ExerciseDTO> exerciseDtos = exercises.Values.Map <IList <ExerciseDTO> >().ToDictionary(t => t.GlobalId);
            TrainingPlanPack pack    = TrainingPlanPack.Create(plan, exerciseDtos);
            SplitPlanChecker checker = new SplitPlanChecker(pack);
            var result = checker.Check(exerciseDtos);

            Assert.AreEqual(2, result.Results.Count);
            Assert.AreEqual(TrainingPlanCheckItemStatus.Information, result.Results[0].Status);
            Assert.AreEqual("Split_IsolationExerciseBeforeCompoud", result.Results[0].ResourceKey);
            Assert.AreEqual(entryIsolated.GlobalId, result.Results[0].TrainingPlanBase.GlobalId);
            Assert.AreEqual(TrainingPlanCheckItemStatus.Information, result.Results[1].Status);
            Assert.AreEqual("Split_IsolationExerciseBeforeCompoud", result.Results[1].ResourceKey);
            Assert.AreEqual(secondIsolated.GlobalId, result.Results[1].TrainingPlanBase.GlobalId);
        }
Ejemplo n.º 7
0
        public void TestEmptyDay()
        {
            TrainingPlan plan = new TrainingPlan();

            plan.RestSeconds  = 60;
            plan.Name         = "name";
            plan.Author       = "author";
            plan.TrainingType = TrainingType.Split;
            var day = new TrainingPlanDay();

            day.Name = "day1";
            plan.AddDay(day);
            checkSingle(plan, day, TrainingPlanCheckItemStatus.Information, "TrainingPlan_EmptyDay");
        }
Ejemplo n.º 8
0
        public void Test()
        {
            Exercise exercise = new Exercise(Guid.NewGuid());

            exercise.Name     = "exercise 1";
            exercise.Shortcut = "E1";
            Exercise exercise2 = new Exercise(Guid.NewGuid());

            exercise2.Name     = "exercise 2";
            exercise2.Shortcut = "E2";
            Exercise exercise3 = new Exercise(Guid.NewGuid());

            exercise3.Name     = "exercise 3";
            exercise3.Shortcut = "E3";
            Exercise exercise4 = new Exercise(Guid.NewGuid());

            exercise4.Name     = "exercise 4";
            exercise4.Shortcut = "E4";
            TrainingPlan    plan = new TrainingPlan();
            TrainingPlanDay day1 = new TrainingPlanDay();

            plan.AddDay(day1);
            TrainingPlanEntry entry = new TrainingPlanEntry();

            entry.Exercise = exercise.Map <ExerciseLightDTO>();
            entry.Sets.Add(new TrainingPlanSerie(12));
            entry.Sets.Add(new TrainingPlanSerie(10));
            entry.Sets.Add(new TrainingPlanSerie(8));
            day1.Entries.Add(entry);

            entry          = new TrainingPlanEntry();
            entry.Exercise = exercise2.Map <ExerciseLightDTO>();
            entry.Sets.Add(new TrainingPlanSerie(10));
            entry.Sets.Add(new TrainingPlanSerie(10));
            entry.Sets.Add(new TrainingPlanSerie(8));
            entry.Sets.Add(new TrainingPlanSerie(6));
            day1.Entries.Add(entry);

            TrainingPlanDay day2 = new TrainingPlanDay();

            plan.AddDay(day2);
            TrainingPlanEntry entry3 = new TrainingPlanEntry();

            day2.Entries.Add(entry3);
            entry3.Exercise = exercise3.Map <ExerciseLightDTO>();
            entry3.Sets.Add(new TrainingPlanSerie(10));
            entry3.Sets.Add(new TrainingPlanSerie(8));
        }
        Service.V2.Model.TrainingPlans.TrainingPlan createWorkoutPlanObject(ProfileDTO profile)
        {
            var contentPlan = new Service.V2.Model.TrainingPlans.TrainingPlan();

            contentPlan.Author = "rtyt";
            //contentPlan.CreationDate = DateTime.Parse("06/28/2011 19:18:26");
            contentPlan.Name     = "rtyre";
            contentPlan.Profile  = profile;
            contentPlan.Language = "en";
            TrainingPlanDay day = new TrainingPlanDay();

            day.Name = "Day 1";
            contentPlan.AddDay(day);
            TrainingPlanEntry entry = new TrainingPlanEntry();

            entry.Exercise = exercise.Map <ExerciseLightDTO>();
            day.AddEntry(entry);
            return(contentPlan);
        }
Ejemplo n.º 10
0
 void check(TrainingPlanDay day, TrainingPlanCheckResult result)
 {
     if (string.IsNullOrEmpty(day.Name))
     {
         result.AddResult(day, "TrainingPlanDay_Name_Empty", TrainingPlanCheckItemStatus.Error);
     }
     //isolation before compoud should be check only in split plan (for now at least)
     if (day.TrainingPlan.TrainingType == TrainingType.Split)
     {
         isolationBeforeCompoudCheck(day, result);
     }
     if (day.Entries.Count == 0)
     {
         result.AddResult(day, "TrainingPlan_EmptyDay", TrainingPlanCheckItemStatus.Information);
     }
     foreach (var planEntry in day.Entries)
     {
         check(planEntry, result);
     }
 }
Ejemplo n.º 11
0
        public void FillTrainingFromPlan(TrainingPlanDay planDay, StrengthTrainingEntryDTO strengthEntry)
        {
            strengthEntry.Entries.Clear();
            foreach (TrainingPlanEntry trainingPlanEntry in planDay.Entries)
            {
                var strengthItem = new StrengthTrainingItemDTO();
                strengthItem.Exercise           = trainingPlanEntry.Exercise;
                strengthItem.DoneWay            = trainingPlanEntry.DoneWay;
                strengthItem.SuperSetGroup      = trainingPlanEntry.GroupName;
                strengthItem.TrainingPlanItemId = trainingPlanEntry.GlobalId;
                strengthEntry.AddEntry(strengthItem);
                foreach (var set in trainingPlanEntry.Sets)
                {
                    var serie = new SerieDTO();
                    if (strengthItem.Exercise.ExerciseType == ExerciseType.Cardio)
                    {
                        if (FillRepetitionNumber && set.RepetitionNumberMin.HasValue)
                        {
                            serie.Weight = set.RepetitionNumberMin.Value;
                        }
                    }
                    else
                    {
                        if (FillRepetitionNumber && set.RepetitionNumberMax.HasValue && set.RepetitionNumberMin.HasValue && set.RepetitionNumberMax == set.RepetitionNumberMin)
                        {
                            serie.RepetitionNumber = set.RepetitionNumberMax.Value;
                        }
                    }


                    serie.IsSuperSlow        = set.IsSuperSlow;
                    serie.IsRestPause        = set.IsRestPause;
                    serie.DropSet            = set.DropSet;
                    serie.SetType            = (SetType)set.RepetitionsType;
                    serie.TrainingPlanItemId = set.GlobalId;
                    strengthItem.AddSerie(serie);
                }
            }
            strengthEntry.TrainingPlanItemId = planDay.GlobalId;
            strengthEntry.TrainingPlanId     = planDay.TrainingPlan.GlobalId;
        }
Ejemplo n.º 12
0
        public void TestExerciseDoesntExist()
        {
            TrainingPlan plan = new TrainingPlan();

            plan.RestSeconds  = 60;
            plan.Name         = "name";
            plan.Author       = "author";
            plan.TrainingType = TrainingType.Split;
            var day = new TrainingPlanDay();

            day.Name = "day1";
            plan.AddDay(day);
            TrainingPlanEntry entry = new TrainingPlanEntry();

            entry.Exercise = new ExerciseLightDTO()
            {
                GlobalId = new Guid("1134E9E3-50DC-4B34-8B67-092084894740")
            };
            day.AddEntry(entry);
            entry.Sets.Add(new TrainingPlanSerie(10));

            checkSingle(plan, entry, TrainingPlanCheckItemStatus.Warning, "TrainingPlan_ExerciseDoesntExist");
        }
Ejemplo n.º 13
0
 public void RemoveDay(TrainingPlanDay entry)
 {
     Days.Remove(entry);
     entry.TrainingPlan = null;
 }
Ejemplo n.º 14
0
 public void AddDay(TrainingPlanDay entry)
 {
     entry.TrainingPlan = this;
     Days.Add(entry);
 }