Skip to content
Draft
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
2 changes: 0 additions & 2 deletions src/app/services/projectService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ describe('ProjectService', () => {
// TODO: add test for service.removeDuplicatePaths()
// TODO: add test for service.pathsEqual()
// TODO: add test for service.getNodeContentByNodeId()
// TODO: add test for service.createGroup()
// TODO: add test for service.createNode()
// TODO: add test for service.createNodeInside()
// TODO: add test for service.createNodeAfter()
// TODO: add test for service.insertNodeAfterInGroups()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,17 @@ export class AddLessonConfigureComponent {

protected submit(): void {
this.submitting = true;
const newLesson = this.projectService.createGroup(
this.addLessonFormGroup.controls['title'].value
);
const newLesson = {
id: this.projectService.getNextAvailableGroupId(),
type: 'group',
title: this.addLessonFormGroup.controls['title'].value,
startId: '',
constraints: [],
transitionLogic: {
transitions: []
},
ids: []
};
if (this.target === 'group0' || this.target === 'inactiveGroups') {
this.projectService.createNodeInside(newLesson, this.target);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,18 @@ export class AddYourOwnNodeComponent {

protected submit(): void {
this.submitting = true;
const newNode = this.projectService.createNode(this.addNodeFormGroup.controls['title'].value);
const newNode = {
id: this.projectService.getNextAvailableNodeId(),
title: this.addNodeFormGroup.controls['title'].value,
type: 'node',
constraints: [],
transitionLogic: {
transitions: []
},
showSaveButton: false,
showSubmitButton: false,
components: []
};
if (this.isGroupNode(this.targetId)) {
this.projectService.createNodeInside(newNode, this.targetId);
} else {
Expand Down
39 changes: 0 additions & 39 deletions src/assets/wise5/services/teacherProjectService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,45 +82,6 @@ export class TeacherProjectService extends ProjectService {
});
}

/**
* Create a new group
* @param title the title of the group
* @returns the group object
*/
createGroup(title: string): any {
return {
id: this.getNextAvailableGroupId(),
type: 'group',
title: title,
startId: '',
constraints: [],
transitionLogic: {
transitions: []
},
ids: []
};
}

/**
* Create a new node
* @param title the title of the node
* @returns the node object
*/
createNode(title) {
return {
id: this.getNextAvailableNodeId(),
title: title,
type: 'node',
constraints: [],
transitionLogic: {
transitions: []
},
showSaveButton: false,
showSubmitButton: false,
components: []
};
}

getNodesWithNewIds(nodes: any[]): any[] {
const oldToNewIds = this.getOldToNewIds(nodes);
return nodes.map((node: any) => {
Expand Down
Loading