From f2e8a914af8ee1359c0096867d7814085d23f30b Mon Sep 17 00:00:00 2001 From: Andrew Paroz Date: Wed, 17 Apr 2024 14:35:56 +1000 Subject: [PATCH 1/2] Provide option to remove disabled from list, instead of always removing them --- Models/Core/Run/Playlist.cs | 2 +- Models/Factorial/Experiment.cs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Models/Core/Run/Playlist.cs b/Models/Core/Run/Playlist.cs index d6687bf92c..3dc58e9c7b 100644 --- a/Models/Core/Run/Playlist.cs +++ b/Models/Core/Run/Playlist.cs @@ -143,7 +143,7 @@ public string[] GenerateListOfSimulations(List allSimulations = null foreach (Experiment exp in allExperiments) { - List expNames = exp.GetSimulationDescriptions().ToList(); + List expNames = exp.GetSimulationDescriptions(false).ToList(); //match experiment name if (regex.IsMatch(exp.Name.ToLower())) { diff --git a/Models/Factorial/Experiment.cs b/Models/Factorial/Experiment.cs index ccb63f67fe..6736c4654f 100644 --- a/Models/Factorial/Experiment.cs +++ b/Models/Factorial/Experiment.cs @@ -34,10 +34,14 @@ public class Experiment : Model, ISimulationDescriptionGenerator public int NumSimulations() => CalculateAllCombinations()?.Count ?? 0; /// Gets a list of simulation descriptions. - public IEnumerable GetSimulationDescriptions() + public IEnumerable GetSimulationDescriptions(bool includeDisabled = true) { // Calculate all combinations. var allCombinations = CalculateAllCombinations(); + if (!includeDisabled && DisabledSimNames != null) { + allCombinations.RemoveAll(comb => DisabledSimNames.Contains(GetName(comb))); + } + if (allCombinations != null) { // Find base simulation. @@ -148,10 +152,6 @@ private List> CalculateAllCombinations() allValues.AddRange(factor.GetPermutations()); } - // Remove disabled simulations. - if (DisabledSimNames != null) - allValues.RemoveAll(comb => DisabledSimNames.Contains(GetName(comb))); - return allValues; } else From ec9b8b84107c9ea2b6538998ea32950f7da3ccf4 Mon Sep 17 00:00:00 2001 From: Andrew Paroz Date: Wed, 17 Apr 2024 14:42:25 +1000 Subject: [PATCH 2/2] Missed a function --- Models/Factorial/Experiment.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Models/Factorial/Experiment.cs b/Models/Factorial/Experiment.cs index 6736c4654f..da30e6e615 100644 --- a/Models/Factorial/Experiment.cs +++ b/Models/Factorial/Experiment.cs @@ -26,7 +26,7 @@ public class Experiment : Model, ISimulationDescriptionGenerator public List DisabledSimNames { get; set; } /// Gets a list of simulation descriptions. - public List GenerateSimulationDescriptions() => GetSimulationDescriptions().ToList(); + public List GenerateSimulationDescriptions() => GetSimulationDescriptions(false).ToList(); /// /// Get the total number of simulations generated by this experiment.