diff --git a/src/assets/wise5/authoringTool/node/node-authoring/node-authoring.component.ts b/src/assets/wise5/authoringTool/node/node-authoring/node-authoring.component.ts index e77e01e6d4c..d8878f10a3d 100644 --- a/src/assets/wise5/authoringTool/node/node-authoring/node-authoring.component.ts +++ b/src/assets/wise5/authoringTool/node/node-authoring/node-authoring.component.ts @@ -212,7 +212,7 @@ export class NodeAuthoringComponent implements OnInit { private checkIfNeedToShowNodeSaveOrNodeSubmitButtons(): void { if (!this.projectService.doesAnyComponentInNodeShowSubmitButton(this.nodeId)) { - if (this.projectService.doesAnyComponentHaveWork(this.nodeId)) { + if (this.hasComponentsWithWork()) { this.nodeJson.showSaveButton = true; this.nodeJson.showSubmitButton = false; this.hideAllComponentSaveButtons(); @@ -223,6 +223,12 @@ export class NodeAuthoringComponent implements OnInit { } } + private hasComponentsWithWork(): boolean { + return this.node.components.some((component) => + this.componentServiceLookupService.getService(component.type).componentHasWork(component) + ); + } + /** * Temporarily highlight the specified components and show the component * authoring views. Used to bring user's attention to new changes. diff --git a/src/assets/wise5/services/teacherProjectService.ts b/src/assets/wise5/services/teacherProjectService.ts index 0b49adfdd56..89aa7eea03b 100644 --- a/src/assets/wise5/services/teacherProjectService.ts +++ b/src/assets/wise5/services/teacherProjectService.ts @@ -1623,22 +1623,6 @@ export class TeacherProjectService extends ProjectService { return component; } - /** - * Returns true iff any component in the step generates work - * @param nodeId the node id - * @return whether any components in the step generates work - */ - doesAnyComponentHaveWork(nodeId) { - const node = this.getNodeById(nodeId); - for (const component of node.components) { - const service = this.componentServiceLookupService.getService(component.type); - if (service != null && service.componentHasWork(component)) { - return true; - } - } - return false; - } - /** * Check if any of the components in the node are showing their submit button. * @param nodeId {string} The node id to check.