diff --git a/src/assets/wise5/authoringTool/project-authoring-step/project-authoring-step.component.ts b/src/assets/wise5/authoringTool/project-authoring-step/project-authoring-step.component.ts index 4dbe7462992..2e6ab73f2a9 100644 --- a/src/assets/wise5/authoringTool/project-authoring-step/project-authoring-step.component.ts +++ b/src/assets/wise5/authoringTool/project-authoring-step/project-authoring-step.component.ts @@ -48,11 +48,39 @@ export class ProjectAuthoringStepComponent { } protected getNumberOfBranchPaths(nodeId: string): number { - return this.projectService.getNumberOfBranchPaths(nodeId); + return this.projectService.getTransitionsByFromNodeId(nodeId).length; } + /** + * If this step is a branch point, we will return the criteria that is used + * to determine which path the student gets assigned to. + * @param nodeId The node id of the branch point. + * @returns A human readable string containing the criteria of how students + * are assigned branch paths on this branch point. + */ protected getBranchCriteriaDescription(nodeId: string): string { - return this.projectService.getBranchCriteriaDescription(nodeId); + const transitionLogic = this.projectService.getNode(nodeId).getTransitionLogic(); + for (const transition of transitionLogic.transitions) { + if (transition.criteria != null && transition.criteria.length > 0) { + for (const singleCriteria of transition.criteria) { + if (singleCriteria.name === 'choiceChosen') { + return 'multiple choice'; + } else if (singleCriteria.name === 'score') { + return 'score'; + } + } + } + } + + /* + * None of the transitions had a specific criteria so the branching is just + * based on the howToChooseAmongAvailablePaths field. + */ + if (transitionLogic.howToChooseAmongAvailablePaths === 'workgroupId') { + return 'workgroup ID'; + } else if (transitionLogic.howToChooseAmongAvailablePaths === 'random') { + return 'random assignment'; + } } protected getStepBackgroundColor(nodeId: string): string { diff --git a/src/assets/wise5/services/teacherProjectService.ts b/src/assets/wise5/services/teacherProjectService.ts index f405cc96cce..0d59a6d3158 100644 --- a/src/assets/wise5/services/teacherProjectService.ts +++ b/src/assets/wise5/services/teacherProjectService.ts @@ -310,51 +310,6 @@ export class TeacherProjectService extends ProjectService { this.project.rubric = html; } - /** - * Get the number of branch paths. This is assuming the node is a branch point. - * @param nodeId The node id of the branch point node. - * @return The number of branch paths for this branch point. - */ - getNumberOfBranchPaths(nodeId) { - const transitions = this.getTransitionsByFromNodeId(nodeId); - if (transitions != null) { - return transitions.length; - } - return 0; - } - - /** - * If this step is a branch point, we will return the criteria that is used - * to determine which path the student gets assigned to. - * @param nodeId The node id of the branch point. - * @returns A human readable string containing the criteria of how students - * are assigned branch paths on this branch point. - */ - getBranchCriteriaDescription(nodeId) { - const transitionLogic = this.getNode(nodeId).getTransitionLogic(); - for (const transition of transitionLogic.transitions) { - if (transition.criteria != null && transition.criteria.length > 0) { - for (const singleCriteria of transition.criteria) { - if (singleCriteria.name === 'choiceChosen') { - return 'multiple choice'; - } else if (singleCriteria.name === 'score') { - return 'score'; - } - } - } - } - - /* - * None of the transitions had a specific criteria so the branching is just - * based on the howToChooseAmongAvailablePaths field. - */ - if (transitionLogic.howToChooseAmongAvailablePaths === 'workgroupId') { - return 'workgroup ID'; - } else if (transitionLogic.howToChooseAmongAvailablePaths === 'random') { - return 'random assignment'; - } - } - setProjectScriptFilename(scriptFilename) { this.project.script = scriptFilename; } diff --git a/src/messages.xlf b/src/messages.xlf index 615caa0e301..338389a2695 100644 --- a/src/messages.xlf +++ b/src/messages.xlf @@ -12809,7 +12809,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.Are you sure you want to delete this step? src/assets/wise5/authoringTool/project-authoring-step/project-authoring-step.component.ts - 112 + 140