refactor(NodeService): Clean up code #2023
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
This pull request focuses on refactoring the
NodeService
and its related services to improve code maintainability and readability. The changes include convertingNodeService
to an abstract class, removing redundant methods, and updating the dependent services accordingly.Refactoring NodeService and related services:
src/assets/wise5/services/nodeService.ts
: ConvertedNodeService
to an abstract class and removed redundant methods such asgetNextNodeId
andgetPrevNodeId
. These methods are now abstract and must be implemented by subclasses. Simplified theletUserChooseTransition
method. [1] [2] [3] [4]src/assets/wise5/services/gradingNodeService.ts
: UpdatedGradingNodeService
to extend the abstractNodeService
and removed redundant methods that are now inherited fromTeacherNodeService
. [1] [2]src/assets/wise5/services/studentNodeService.ts
: UpdatedStudentNodeService
to implement the abstract methods fromNodeService
. Added thegetPrevNodeId
method. [1] [2]src/assets/wise5/services/teacherNodeService.ts
: Implemented the abstract methodsgetNextNodeId
andgetPrevNodeId
fromNodeService
.Import and dependency updates:
src/assets/wise5/components/dialogGuidance/dialog-guidance-authoring/dialog-guidance-authoring.module.ts
: RemovedNodeService
import and addedTeacherNodeService
import. Updated the providers list accordingly. [1] [2] [3]src/assets/wise5/components/embedded/embedded-authoring/embedded-authoring.module.ts
: RemovedNodeService
import and addedTeacherNodeService
import. Updated the providers list accordingly. [1] [2] [3]Test
Applications work as before