Exemplo n.º 1
0
        public void FillTrainingFromPlan(TrainingPlanDay planDay, StrengthTrainingEntryDTO strengthEntry)
        {
            strengthEntry.Entries.Clear();
            foreach (TrainingPlanEntry trainingPlanEntry in planDay.Entries)
            {
                var strengthItem = new StrengthTrainingItemDTO();
                strengthItem.ExerciseId         = trainingPlanEntry.ExerciseId;
                strengthItem.TrainingPlanItemId = trainingPlanEntry.GlobalId;
                strengthEntry.AddEntry(strengthItem);
                foreach (var set in trainingPlanEntry.Sets)
                {
                    var serie = new SerieDTO();
                    if (FillRepetitionNumber && set.RepetitionNumberMax.HasValue && set.RepetitionNumberMin.HasValue && set.RepetitionNumberMax == set.RepetitionNumberMin)
                    {
                        serie.RepetitionNumber = set.RepetitionNumberMax.Value;
                    }
                    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;

            fillSuperSets(planDay, strengthEntry);
        }
Exemplo n.º 2
0
        void isolationBeforeCompoudCheck(TrainingPlanDay day, TrainingPlanCheckResult result)
        {
            var musleSplit = from e1 in day.Entries
                             join exercise in this.exercisesPack.Values on e1.ExerciseId equals exercise.GlobalId
                             where pack.Exercises.Contains(e1.ExerciseId)
                             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.ExerciseId];
                    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();
                    }
                }
            }
        }
Exemplo n.º 3
0
 void fillSuperSets(TrainingPlanDay planDay, StrengthTrainingEntryDTO strengthEntry)
 {
     foreach (SuperSet superSet in planDay.SuperSets)
     {
         foreach (var trainingPlanEntry in superSet.SuperSets)
         {
             var item1 = findStrengthTrainingItemByTrainingPlanItemId(trainingPlanEntry.GlobalId, strengthEntry);
             if (item1 != null)
             {
                 item1.SuperSetGroup = superSet.SuperSetId.ToString();
             }
         }
     }
 }
Exemplo n.º 4
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);
     }
 }
Exemplo n.º 5
0
 public void RemoveDay(TrainingPlanDay entry)
 {
     Days.Remove(entry);
     entry.TrainingPlan = null;
 }
Exemplo n.º 6
0
 public void AddDay(TrainingPlanDay entry)
 {
     entry.TrainingPlan = this;
     Days.Add(entry);
 }