Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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.
Expand Down
16 changes: 0 additions & 16 deletions src/assets/wise5/services/teacherProjectService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down