Skip to content

Commit

Permalink
Fix #491: SelectedIterationSetup correctly set (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoineatstariongroup authored Jan 8, 2024
1 parent dab58a2 commit e89974f
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions COMET.Web.Common/ViewModels/Components/OpenModelViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void InitializesProperties()
this.IsOpeningSession = false;

this.AvailableEngineeringModelSetups = this.sessionService.GetParticipantModels()
.Where(x => x.IterationSetup.Any(setup => this.sessionService.OpenIterations.Items.All(i => i.Iid != setup.IterationIid)))
.Where(x => x.IterationSetup.Exists(setup => this.sessionService.OpenIterations.Items.All(i => i.Iid != setup.IterationIid)))
.OrderBy(x => x.Name);
}

Expand Down Expand Up @@ -169,7 +169,7 @@ await this.sessionService.ReadIteration(this.SelectedEngineeringModel.IterationS
public void PreSelectIteration(Guid modelId, Guid iterationId, Guid domainId)
{
this.selectedEngineeringModel = this.AvailableEngineeringModelSetups.FirstOrDefault(x => x.Iid == modelId);
var iterationSetup = this.SelectedEngineeringModel?.IterationSetup.FirstOrDefault(x => x.IterationIid == iterationId);
var iterationSetup = this.SelectedEngineeringModel?.IterationSetup.Find(x => x.IterationIid == iterationId);

if (iterationSetup != null)
{
Expand All @@ -194,19 +194,16 @@ private void ComputeAvailableCollections()
}
else
{
this.SelectedIterationSetup = this.selectedEngineeringModel.IterationSetup
.Where(x => x.FrozenOn == null)
.Select(x => new IterationData(x))
.LastOrDefault();

this.SelectedDomainOfExpertise = this.SelectedEngineeringModel.ActiveDomain.FirstOrDefault(x => x == this.sessionService.Session.ActivePerson.DefaultDomain);
this.SelectedDomainOfExpertise = this.SelectedEngineeringModel.ActiveDomain.Find(x => x == this.sessionService.Session.ActivePerson.DefaultDomain);

this.AvailablesDomainOfExpertises = this.sessionService.GetModelDomains(this.SelectedEngineeringModel);

this.AvailableIterationSetups = this.SelectedEngineeringModel.IterationSetup
.Where(x => this.sessionService.OpenIterations.Items.All(i => i.Iid != x.IterationIid))
.OrderBy(x => x.IterationNumber)
.Select(x => new IterationData(x));

this.SelectedIterationSetup = this.AvailableIterationSetups.Last();
}
}
}
Expand Down

0 comments on commit e89974f

Please sign in to comment.