Skip to content

Commit a9d67f0

Browse files
Cleaned up code related to MC grading. #2935
1 parent 1caa081 commit a9d67f0

3 files changed

Lines changed: 6 additions & 11 deletions

File tree

src/main/webapp/wise5/classroomMonitor/classroomMonitorComponents/shared/componentRevisionsInfo/componentRevisionsInfo.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,9 @@ class ComponentRevisionsInfoController {
6161
}
6262

6363
if (latest) {
64-
// calculate the save time of the latest component state
6564
this.latestComponentStateTime = this.ConfigService.convertToClientTimestamp(
6665
latest.serverSaveTime
6766
);
68-
69-
// check if the latest component state is a submit
7067
this.latestComponentStateIsSubmit = latest.isSubmit;
7168
}
7269
}

src/main/webapp/wise5/components/multipleChoice/multiple-choice-grading/multiple-choice-grading.component.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ export class MultipleChoiceGrading extends ComponentGrading {
5151
}
5252

5353
getChoiceIds(choices: any[]): string[] {
54-
const choiceIds: string[] = [];
55-
for (const choice of choices) {
56-
choiceIds.push(choice.id);
57-
}
58-
return choiceIds;
54+
return choices.map((choice) => {
55+
return choice.id;
56+
});
5957
}
6058

6159
processChoices(choices: any[], studentChoices: any[]): any[] {

src/main/webapp/wise5/components/multipleChoice/multipleChoiceService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export class MultipleChoiceService extends ComponentService {
208208
return correctChoiceIds;
209209
}
210210

211-
getChoicesIdsStudentChose(studentChoices: any[]): any {
211+
getChoicesIdsStudentChose(studentChoices: any[]): string[] {
212212
const studentChoiceIds: string[] = [];
213213
for (const studentChoice of studentChoices) {
214214
studentChoiceIds.push(studentChoice.id);
@@ -222,8 +222,8 @@ export class MultipleChoiceService extends ComponentService {
222222
} else {
223223
choiceIds1.sort();
224224
choiceIds2.sort();
225-
for (let choiceIdIndex = 0; choiceIdIndex < choiceIds1.length; choiceIdIndex++) {
226-
if (choiceIds1[choiceIdIndex] !== choiceIds2[choiceIdIndex]) {
225+
for (let i = 0; i < choiceIds1.length; i++) {
226+
if (choiceIds1[i] !== choiceIds2[i]) {
227227
return false;
228228
}
229229
}

0 commit comments

Comments
 (0)