Skip to content

Commit

Permalink
fix(Classroom Monitor): Grade by Student sort by location (#1667)
Browse files Browse the repository at this point in the history
  • Loading branch information
breity authored Feb 29, 2024
1 parent 90c4007 commit 822f46f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class ClassroomMonitorTestHelper {
students: StudentProgress[] = [
new StudentProgress({
location: '1.2: Open Response',
order: 2,
workgroupId: this.workgroupId1,
username: 'Spongebob Squarepants',
firstName: 'Spongebob',
Expand All @@ -19,6 +20,7 @@ export class ClassroomMonitorTestHelper {
}),
new StudentProgress({
location: '1.1: Open Response',
order: 1,
workgroupId: this.workgroupId5,
username: 'Patrick Star',
firstName: 'Patrick',
Expand All @@ -28,6 +30,7 @@ export class ClassroomMonitorTestHelper {
}),
new StudentProgress({
location: '1.5: Open Response',
order: 5,
workgroupId: this.workgroupId3,
username: 'Squidward Tentacles',
firstName: 'Squidward',
Expand All @@ -36,7 +39,8 @@ export class ClassroomMonitorTestHelper {
scorePct: 0.4
}),
new StudentProgress({
location: '1.9: Open Response',
location: '1.11: Open Response',
order: 11,
workgroupId: this.workgroupId2,
username: 'Sandy Cheeks',
firstName: 'Sandy',
Expand All @@ -46,6 +50,7 @@ export class ClassroomMonitorTestHelper {
}),
new StudentProgress({
location: '1.5: Open Response',
order: 5,
workgroupId: this.workgroupId4,
username: 'Sheldon Plankton',
firstName: 'Sheldon',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</td>
</ng-container>
<td class="center td--wrap td--max-width">
{{ student.location }}
{{ student.position }}
</td>
<td fxLayout="row" fxLayoutAlign="center center">
<project-progress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class StudentProgressComponent implements OnInit {
},
location: {
label: $localize`Location`,
fieldName: 'location',
fieldName: 'order',
isNumeric: true
},
completion: {
Expand Down Expand Up @@ -117,15 +117,16 @@ export class StudentProgressComponent implements OnInit {
}

private updateTeam(workgroupId: number): void {
const location = this.getCurrentNodeForWorkgroupId(workgroupId) || '';
const location = this.classroomStatusService.getCurrentNodeLocationForWorkgroupId(workgroupId);
const completion = this.classroomStatusService.getStudentProjectCompletion(workgroupId);
const score = this.getStudentTotalScore(workgroupId) || 0;
let maxScore = this.classroomStatusService.getMaxScoreForWorkgroupId(workgroupId);
maxScore = maxScore ? maxScore : 0;

for (const student of this.students) {
if (student.workgroupId === workgroupId) {
student.location = location;
student.position = location?.position || '';
student.order = location?.order || 0;
student.completion = completion;
student.completionPct = completion.completionPct || 0;
student.score = score;
Expand All @@ -135,12 +136,6 @@ export class StudentProgressComponent implements OnInit {
}
}

private getCurrentNodeForWorkgroupId(workgroupId: number): string {
return this.classroomStatusService.getCurrentNodePositionAndNodeTitleForWorkgroupId(
workgroupId
);
}

private getStudentTotalScore(workgroupId: number): number {
return this.dataService.getTotalScoreByWorkgroupId(workgroupId);
}
Expand Down Expand Up @@ -214,7 +209,8 @@ export class StudentProgress {
username: string;
firstName: string;
lastName: string;
location: string;
position: string;
order: number;
completion: ProjectCompletion;
completionPct: number;
score: number;
Expand Down
13 changes: 5 additions & 8 deletions src/assets/wise5/services/classroomStatusService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,14 @@ export class ClassroomStatusService {
return this.studentStatuses;
}

/**
* Get the current node position and title for a workgroup
* e.g. 2.2: Newton Scooter Concepts
* @param workgroupId the workgroup id
* @returns the node position and title
*/
getCurrentNodePositionAndNodeTitleForWorkgroupId(workgroupId) {
getCurrentNodeLocationForWorkgroupId(workgroupId: number): any {
const studentStatus = this.getStudentStatusForWorkgroupId(workgroupId);
if (studentStatus != null) {
const currentNodeId = studentStatus.currentNodeId;
return this.projectService.getNodePositionAndTitle(currentNodeId);
return {
position: this.projectService.getNodePositionAndTitle(currentNodeId),
order: this.projectService.getNodeOrderById(currentNodeId)
};
}
return null;
}
Expand Down

0 comments on commit 822f46f

Please sign in to comment.