Skip to content

Commit

Permalink
Simplified geting max value from result times
Browse files Browse the repository at this point in the history
  • Loading branch information
michasacuer committed Jan 7, 2020
1 parent f3e773f commit 16ea66d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/Thinning.Infrastructure/ApplicationSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Thinning.Algorithm;
using Thinning.Algorithm.Interfaces;
using Thinning.Infrastructure.Interfaces;

Expand Down
15 changes: 9 additions & 6 deletions src/Thinning.UI/Helpers/MainWindowViewModelHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,19 @@ private void AttachResultsToAlgorithms(TestResult testResult)

private double GetMaxValueFromResultTimes(List<List<double>> times)
{
var topValues = new List<double>();
double topValue = 0;
foreach (var timesList in times)
{
var sortedList = new List<double>(timesList).OrderByDescending(t => t).ToList();
topValues.Add(sortedList.First());
foreach (double time in timesList)
{
if (time > topValue)
{
topValue = time;
}
}
}

topValues = topValues.OrderByDescending(t => t).ToList();

return topValues.First();
return topValue;
}
}
}

0 comments on commit 16ea66d

Please sign in to comment.