File tree Expand file tree Collapse file tree 2 files changed +7
-17
lines changed
authoringTool/node/node-authoring Expand file tree Collapse file tree 2 files changed +7
-17
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ export class NodeAuthoringComponent implements OnInit {
212212
213213 private checkIfNeedToShowNodeSaveOrNodeSubmitButtons ( ) : void {
214214 if ( ! this . projectService . doesAnyComponentInNodeShowSubmitButton ( this . nodeId ) ) {
215- if ( this . projectService . doesAnyComponentHaveWork ( this . nodeId ) ) {
215+ if ( this . hasComponentsWithWork ( ) ) {
216216 this . nodeJson . showSaveButton = true ;
217217 this . nodeJson . showSubmitButton = false ;
218218 this . hideAllComponentSaveButtons ( ) ;
@@ -223,6 +223,12 @@ export class NodeAuthoringComponent implements OnInit {
223223 }
224224 }
225225
226+ private hasComponentsWithWork ( ) : boolean {
227+ return this . node . components . some ( ( component ) =>
228+ this . componentServiceLookupService . getService ( component . type ) . componentHasWork ( component )
229+ ) ;
230+ }
231+
226232 /**
227233 * Temporarily highlight the specified components and show the component
228234 * authoring views. Used to bring user's attention to new changes.
Original file line number Diff line number Diff line change @@ -1509,22 +1509,6 @@ export class TeacherProjectService extends ProjectService {
15091509 return component ;
15101510 }
15111511
1512- /**
1513- * Returns true iff any component in the step generates work
1514- * @param nodeId the node id
1515- * @return whether any components in the step generates work
1516- */
1517- doesAnyComponentHaveWork ( nodeId ) {
1518- const node = this . getNodeById ( nodeId ) ;
1519- for ( const component of node . components ) {
1520- const service = this . componentServiceLookupService . getService ( component . type ) ;
1521- if ( service != null && service . componentHasWork ( component ) ) {
1522- return true ;
1523- }
1524- }
1525- return false ;
1526- }
1527-
15281512 /**
15291513 * Check if any of the components in the node are showing their submit button.
15301514 * @param nodeId {string} The node id to check.
You can’t perform that action at this time.
0 commit comments