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
13 changes: 0 additions & 13 deletions src/app/services/teacherProjectService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ describe('TeacherProjectService', () => {
getNextAvailableNodeId();
shouldReturnTheNextAvailableGroupId();
shouldReturnTheGroupIdsInTheProject();
shouldReturnTheMaxScoreOfTheProject();
shouldNotAddSpaceIfItDoesExist();
shouldAddSpaceIfItDoesntExist();
shouldRemoveSpaces();
Expand Down Expand Up @@ -293,18 +292,6 @@ function shouldReturnTheGroupIdsInTheProject() {
});
}

function shouldReturnTheMaxScoreOfTheProject() {
it('should return the max score of the project', () => {
service.setProject(demoProjectJSON);
const demoProjectMaxScoreActual = service.getMaxScore();
expect(demoProjectMaxScoreActual).toEqual(9);
service.setProject(scootersProjectJSON);
const scootersProjectMaxScoreExpected = 18;
const scootersProjectMaxScoreActual = service.getMaxScore();
expect(scootersProjectMaxScoreActual).toEqual(scootersProjectMaxScoreExpected);
});
}

function shouldNotAddSpaceIfItDoesExist() {
it('should not add space if it does exist', () => {
service.setProject(scootersProjectJSON);
Expand Down
68 changes: 0 additions & 68 deletions src/assets/wise5/services/teacherProjectService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -670,42 +670,6 @@ export class TeacherProjectService extends ProjectService {
}
}

addNodeToGroup(node, group) {
if (this.isGroupHasNode(group)) {
this.insertAfterLastNode(node, group);
} else {
this.insertAsFirstNode(node, group);
}
}

isGroupHasNode(group) {
return group.ids.length != 0;
}

getLastNodeInGroup(group) {
const lastNodeId = group.ids[group.ids.length - 1];
return this.idToNode[lastNodeId];
}

insertAsFirstNode(node, group) {
this.insertNodeInsideOnlyUpdateTransitions(node.id, group.id);
this.insertNodeInsideInGroups(node.id, group.id);
}

insertAfterLastNode(node, group) {
const lastNode = this.getLastNodeInGroup(group);
this.insertNodeAfterInTransitions(node, lastNode.id);
this.insertNodeAfterInGroups(node.id, lastNode.id);
}

createNodeAndAddToLocalStorage(nodeTitle) {
const node = this.createNode(nodeTitle);
this.setIdToNode(node.id, node);
this.addNode(node);
this.applicationNodes.push(node);
return node;
}

getAutomatedAssessmentProjectId(): number {
return this.configService.getConfigParam('automatedAssessmentProjectId') || -1;
}
Expand Down Expand Up @@ -1789,38 +1753,6 @@ export class TeacherProjectService extends ProjectService {
}
}

/**
* TODO: Deprecated, should be removed; replaced by getMaxScoreForWorkgroupId in
* ClassroomStatusService
* Get the max score for the project. If the project contains branches, we
* will only calculate the max score for a single path from the first node
* to the last node in the project.
* @returns the max score for the project or null if none of the components in the project
* has max scores.
*/
getMaxScore() {
let maxScore = null;
const startNodeId = this.getStartNodeId();

// get all the paths in the project
const allPaths = this.getAllPaths([], startNodeId);

if (allPaths != null && allPaths.length > -1) {
const firstPath = allPaths[0];
for (let nodeId of firstPath) {
const nodeMaxScore = this.getMaxScoreForNode(nodeId);
if (nodeMaxScore != null) {
if (maxScore == null) {
maxScore = nodeMaxScore;
} else {
maxScore += nodeMaxScore;
}
}
}
}
return maxScore;
}

setMaxScoreForComponent(nodeId: string, componentId: string, maxScore: number): void {
const component = this.getComponent(nodeId, componentId);
if (component != null) {
Expand Down