diff --git a/src/assets/wise5/services/teacherDataService.ts b/src/assets/wise5/services/teacherDataService.ts index 1466c1dacb8..2355a432961 100644 --- a/src/assets/wise5/services/teacherDataService.ts +++ b/src/assets/wise5/services/teacherDataService.ts @@ -232,23 +232,6 @@ export class TeacherDataService extends DataService { return this.retrieveStudentData(params); } - retrieveLatestStudentDataByNodeIdAndComponentIdAndPeriodId(nodeId, componentId, periodId) { - let params = new HttpParams() - .set('runId', this.ConfigService.getRunId()) - .set('nodeId', nodeId) - .set('componentId', componentId) - .set('getStudentWork', 'true') - .set('getEvents', 'false') - .set('getAnnotations', 'false') - .set('onlyGetLatest', 'true'); - if (periodId != null) { - params = params.set('periodId', periodId); - } - return this.retrieveStudentData(params).subscribe((result) => { - return result.studentWorkList; - }); - } - retrieveStudentData(params): Observable { const url = this.ConfigService.getConfigParam('teacherDataURL'); const options = { @@ -440,20 +423,17 @@ export class TeacherDataService extends DataService { return -1; } - retrieveRunStatus() { - const url = this.ConfigService.getConfigParam('runStatusURL'); - const params = new HttpParams().set('runId', this.ConfigService.getConfigParam('runId')); + retrieveRunStatus(): Observable { const options = { - params: params, + params: new HttpParams().set('runId', this.ConfigService.getConfigParam('runId')), headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }; - return this.http - .get(url, options) - .toPromise() - .then((data: any) => { - this.runStatus = data; + return this.http.get(this.ConfigService.getConfigParam('runStatusURL'), options).pipe( + tap((runStatus: any) => { + this.runStatus = runStatus; this.initializePeriods(); - }); + }) + ); } getComponentStatesByWorkgroupId(workgroupId) { @@ -616,12 +596,12 @@ export class TeacherDataService extends DataService { } } - initializePeriods() { + private initializePeriods(): void { const periods = [...this.ConfigService.getPeriods()]; if (this.currentPeriod == null) { this.setCurrentPeriod(periods[0]); } - this.addAllPeriods(periods); + periods.unshift({ periodId: -1, periodName: $localize`All Periods` }); let mergedPeriods = periods; if (this.runStatus.periods != null) { mergedPeriods = this.mergeConfigAndRunStatusPeriods(periods, this.runStatus.periods); @@ -630,35 +610,17 @@ export class TeacherDataService extends DataService { this.runStatus.periods = mergedPeriods; } - addAllPeriods(periods: any[]): void { - periods.unshift({ - periodId: -1, - periodName: $localize`All Periods` - }); - } - - mergeConfigAndRunStatusPeriods(configPeriods, runStatusPeriods) { + private mergeConfigAndRunStatusPeriods(configPeriods: any[], runStatusPeriods: any[]): any[] { const mergedPeriods = []; - for (const configPeriod of configPeriods) { - const runStatusPeriod = this.getRunStatusPeriodById(runStatusPeriods, configPeriod.periodId); - if (runStatusPeriod == null) { - mergedPeriods.push(configPeriod); - } else { - mergedPeriods.push(runStatusPeriod); - } - } + configPeriods.forEach((configPeriod) => { + const runStatusPeriod = runStatusPeriods.find( + (runStatusPeriod) => runStatusPeriod.periodId === configPeriod.periodId + ); + mergedPeriods.push(runStatusPeriod != null ? runStatusPeriod : configPeriod); + }); return mergedPeriods; } - getRunStatusPeriodById(runStatusPeriods, periodId) { - for (const runStatusPeriod of runStatusPeriods) { - if (runStatusPeriod.periodId == periodId) { - return runStatusPeriod; - } - } - return null; - } - setCurrentPeriod(period) { const previousPeriod = this.currentPeriod; this.currentPeriod = period; diff --git a/src/messages.xlf b/src/messages.xlf index e1509d04708..e486798e965 100644 --- a/src/messages.xlf +++ b/src/messages.xlf @@ -7568,19 +7568,15 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.27 - - scheduled + + scheduled src/app/student/student-run-list/student-run-list.component.html 30 - - src/app/teacher/teacher-run-list/teacher-run-list.component.html - 46 - - - active + + active src/app/student/student-run-list/student-run-list.component.html 33 @@ -8949,6 +8945,13 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.43 + + scheduled + + src/app/teacher/teacher-run-list/teacher-run-list.component.html + 46 + + Clear filters @@ -12784,14 +12787,14 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.New Team has been created. src/assets/wise5/classroomMonitor/classroomMonitorComponents/manageStudents/add-team-dialog/add-team-dialog.component.ts - 82 + 83 Error: Could not create team. src/assets/wise5/classroomMonitor/classroomMonitorComponents/manageStudents/add-team-dialog/add-team-dialog.component.ts - 87 + 90 @@ -12906,7 +12909,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.Moved Team to Period . src/assets/wise5/classroomMonitor/classroomMonitorComponents/manageStudents/change-team-period-dialog/change-team-period-dialog.component.ts - 54 + 55 @@ -12994,14 +12997,14 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.Moved student to Team . src/assets/wise5/classroomMonitor/classroomMonitorComponents/manageStudents/manage-team/manage-team.component.ts - 106 + 107 Error: Could not move student. src/assets/wise5/classroomMonitor/classroomMonitorComponents/manageStudents/manage-team/manage-team.component.ts - 109 + 112 @@ -13605,7 +13608,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. src/assets/wise5/services/teacherDataService.ts - 636 + 604