Skip to content

Commit

Permalink
Merge pull request #308 from bschwehn/fix/previous-number-of-reps
Browse files Browse the repository at this point in the history
  • Loading branch information
LiamMorrow authored Oct 31, 2024
2 parents 3e1166c + 565d3a4 commit 373adbe
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions LiftLog.Ui/Shared/Presentation/ExerciseSummary.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
@{
var splitWeights = (Exercise.PerSetWeight
&& !Exercise.PotentialSets.All(s => s.Weight == Exercise.Weight))
|| Exercise.PotentialSets.DistinctBy(x=>x.Set?.RepsCompleted).Count() != 1;
var numberOfSetsCompleted = Exercise.PotentialSets.Count(s => s.Set != null);
var maxRepsCompleted = Exercise.PotentialSets.Max(s => s.Set?.RepsCompleted);

var allPerformedSetsHaveSameReps = Exercise.PotentialSets
.Where(x => x.Set != null)
.DistinctBy(x => x.Set?.RepsCompleted).Count() == 1;

var splitWeights = (Exercise.PerSetWeight
&& !Exercise.PotentialSets.All(s => s.Weight == Exercise.Weight))
|| !allPerformedSetsHaveSameReps;
}
<span class="flex items-center">
@if(ShowName)
Expand All @@ -17,7 +24,7 @@
@if (ShowSets)
{
<span>
@(Exercise.Blueprint.Sets)x@(Exercise.Blueprint.RepsPerSet)
@(numberOfSetsCompleted)x@(maxRepsCompleted)
</span>
@if(ShowWeight)
{
Expand Down

0 comments on commit 373adbe

Please sign in to comment.