diff --git a/GsaGH/Components/4_Analysis/AnalyseModel.cs b/GsaGH/Components/4_Analysis/AnalyseModel.cs index 9ee3be477..89d8aeba5 100644 --- a/GsaGH/Components/4_Analysis/AnalyseModel.cs +++ b/GsaGH/Components/4_Analysis/AnalyseModel.cs @@ -222,7 +222,7 @@ protected override void SolveInternal(IGH_DataAccess da) { if (_analysis) { IReadOnlyDictionary gsaTasks = model.ApiModel.AnalysisTasks(); if (gsaTasks.Count < 1) { - int taskId = TaskHelper.CreateDefaultStaticAnalysisTask(ref model); + int taskId = TaskHelper.CreateDefaultStaticAnalysisTask(model); var task = new GsaAnalysisTask(taskId, model.ApiModel); if (task.Cases == null || task.Cases.Count == 0) { this.AddRuntimeWarning( diff --git a/GsaGH/Helpers/TaskHelper.cs b/GsaGH/Helpers/TaskHelper.cs index 2ff091890..ca8d5e5b7 100644 --- a/GsaGH/Helpers/TaskHelper.cs +++ b/GsaGH/Helpers/TaskHelper.cs @@ -9,16 +9,15 @@ namespace GsaGH.Helpers { internal static partial class TaskHelper { - public static int CreateDefaultStaticAnalysisTask(ref GsaModel model) { + public static int CreateDefaultStaticAnalysisTask(GsaModel model) { int taskId = model.ApiModel.AddAnalysisTask(); model.ApiModel.CreateDefaultAnalysisCasesForTheTask(taskId); return taskId; } - public static int AddAnalysisTask(ref GsaAnalysisTask task, ref GsaModel model) { - int taskId = model.ApiModel.AddAnalysisTask(task.ApiTask); - model.ApiModel.CreateDefaultAnalysisCasesForTheTask(taskId); - return taskId; + public static void AddAnalysisTask(GsaAnalysisTask task, GsaModel model) { + task.Id = model.ApiModel.AddAnalysisTask(task.ApiTask); + model.ApiModel.CreateDefaultAnalysisCasesForTheTask(task.Id); } public static void ImportAnalysisTask(GsaAnalysisTask task, ref GsaModel model) { @@ -31,7 +30,7 @@ public static void ImportAnalysisTask(GsaAnalysisTask task, ref GsaModel model) } if (task.ApiTask != null) { if (analysisCases.Count == 0) { - AddAnalysisTask(ref task, ref model); + AddAnalysisTask(task, model); } else { model.ApiModel.ImportAnalysisTask(task.ApiTask, new ReadOnlyDictionary(analysisCases)); task.Id = highestTask + 1; diff --git a/GsaGHTests/1_BaseParameters/4_Analysis/GsaAnalysisTaskTest.cs b/GsaGHTests/1_BaseParameters/4_Analysis/GsaAnalysisTaskTest.cs index ca2c44cb8..74f37bf1f 100644 --- a/GsaGHTests/1_BaseParameters/4_Analysis/GsaAnalysisTaskTest.cs +++ b/GsaGHTests/1_BaseParameters/4_Analysis/GsaAnalysisTaskTest.cs @@ -67,7 +67,7 @@ public void AnalysisCasesAreAppendedWhenAnalysisCaseIsAlreadyAttachedToAnotherTa [Fact] public void ShouldCreateDefaultTask() { - TaskHelper.CreateDefaultStaticAnalysisTask(ref _model); + TaskHelper.CreateDefaultStaticAnalysisTask( _model); Assert.Single(_model.ApiModel.AnalysisTasks()); }