Open-Systems-Pharmacology / PK-Sim

PK-Sim® is a comprehensive software tool for whole-body physiologically based pharmacokinetic modeling
Other
98 stars 49 forks source link

Simulations -> Create Subfolders by -> Compound -> Error #2817

Closed PavelBal closed 8 months ago

PavelBal commented 8 months ago

I have simulations with two compounds. When I try to create sub-folders of simulations by compound, I get:

Application: PK-Sim® 11.2.142

Sequence contains more than one element

Stack trace:

at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
   at PKSim.Core.Model.Simulation.UsedBuildingBlockInSimulation(PKSimBuildingBlockType buildingBlockType)
   at PKSim.Core.Model.Simulation.BuildingBlockName(PKSimBuildingBlockType buildingBlockType)
   at PKSim.Presentation.Presenters.Main.SimulationExplorerPresenter.retrieveCategoryValue(ClassifiableSimulation classifiableSimulation, String category)
   at PKSim.Presentation.Presenters.Main.SimulationExplorerPresenter.<>c__DisplayClass29_0.<AddToClassificationTree>b__0(ClassifiableSimulation s)
   at OSPSuite.Presentation.Presenters.Classifications.ClassificationPresenter.<>c__DisplayClass16_0`1.<GroupClassificationsByCategory>b__1(TClassifiable classifiable)
   at OSPSuite.Utility.Extensions.EnumerableExtensions.Each[T](IEnumerable`1 list, Action`1 action)
   at OSPSuite.Presentation.Presenters.Classifications.ClassificationPresenter.GroupClassificationsByCategory[TClassifiable](ITreeNode`1 parentNode, String category, Func`2 retrieveClassificationNameFromCategory)
   at PKSim.Presentation.Presenters.Main.SimulationExplorerPresenter.AddToClassificationTree(ITreeNode`1 parentNode, String category)
   at PKSim.Presentation.Presenters.ContextMenus.SimulationFolderTreeNodeContextMenu.<>c__DisplayClass2_1.<createGroupByMenu>b__1()
   at OSPSuite.Presentation.MenuAndBars.ExecuteActionUICommand.Execute()
   at OSPSuite.Presentation.UICommands.UICommandExtensions.ExecuteWithinExceptionHandler(IUICommand uiCommand, IEventPublisher eventPublisher, IChangePropagator changePropagator)
PavelBal commented 8 months ago

Aaaah I have multiple compounds in a simulation, probably thats why..

msevestre commented 8 months ago

Interesting 🤔. What should be the behaviour in this case. Pit the simulation in only one is the easiest probably

PavelBal commented 8 months ago

Yeah good question. Offer a selection dialog?

msevestre commented 8 months ago

too much work for something tha tis purely presentation. User can drag and drop somewhere else if required

Yuri05 commented 8 months ago

If a simulation has >1 compounds, I would suggest picking the first administered compound from the simulation for the folder assignment