Skip to content

Commit

Permalink
fix(VLE): Step save button now works with Dynamic Components (#1208)
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffreykwan authored Apr 26, 2023
1 parent 97fede6 commit 85812f6
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions src/assets/wise5/vle/node/node.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,16 +360,16 @@ export class NodeComponent implements OnInit {
});
}

private getComponentsToSave(componentId: string): any {
private getComponentsToSave(componentId: string): any[] {
if (componentId) {
const components = [];
const component = this.node.getComponent(componentId);
if (component) {
components.push(component);
}
return components;
return [this.node.getComponent(componentId)];
} else {
return this.getComponents();
const nodeStatus = this.studentDataService.getNodeStatusByNodeId(this.node.id);
return this.getComponents().filter(
(component) =>
this.workComponents.includes(component.type) &&
nodeStatus.componentStatuses[component.id].isVisible
);
}
}

Expand All @@ -380,14 +380,10 @@ export class NodeComponent implements OnInit {
): any[] {
const componentStatePromises = [];
for (const component of components) {
const componentId = component.id;
const componentType = component.type;
if (this.workComponents.includes(componentType)) {
componentStatePromises.push(
this.getComponentStatePromiseFromService(this.node.id, componentId, isAutoSave, isSubmit)
);
this.componentService.requestComponentState(this.node.id, componentId, isSubmit);
}
componentStatePromises.push(
this.getComponentStatePromiseFromService(this.node.id, component.id, isAutoSave, isSubmit)
);
this.componentService.requestComponentState(this.node.id, component.id, isSubmit);
}
return componentStatePromises;
}
Expand Down

0 comments on commit 85812f6

Please sign in to comment.