Skip to content

Commit

Permalink
Merge pull request #18 from netgrif/NAB-373
Browse files Browse the repository at this point in the history
[NAB-373] - Place reference value not changed on simulation
  • Loading branch information
mazarijuraj authored Nov 29, 2024
2 parents 97fe0e9 + 2996490 commit 2b0ecfb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/app/modeler/services/model/model.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,17 +478,17 @@ export class ModelService {
return newPosition;
}

public getReferenceValue(id: string): number {
public getReferenceValue(id: string, model: PetriNet = this.model): number {
// TODO: NAB-326 probably move to petriflow.js
const referencedData = this.model.getData(id);
const referencedData = model.getData(id);
if (referencedData) {
if (referencedData.init.value) {
return Number(referencedData.init.value);
// TODO: NAB-326 check if isFinite and >= 0
}
return 0;
}
const referencedPlace = this.model.getPlace(id);
const referencedPlace = model.getPlace(id);
if (referencedPlace) {
return referencedPlace.marking;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/modeler/simulation-mode/simulation-mode.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class SimulationModeService extends CanvasModeService<SimulationTool> {
if (this.data.has(a.modelArc.reference)) {
multiplicity = this.data.get(a.modelArc.reference);
} else {
multiplicity = this.modelService.getReferenceValue(a.modelArc.reference);
multiplicity = this.modelService.getReferenceValue(a.modelArc.reference, this.model);
}
return `${a.modelArc.reference} (${multiplicity})`;
}
Expand Down

0 comments on commit 2b0ecfb

Please sign in to comment.