@@ -14,7 +14,6 @@ import { isMatchingPeriods } from '../common/period/period';
1414import { getIntersectOfArrays } from '../common/array/array' ;
1515import { serverSaveTimeComparator } from '../common/object/object' ;
1616import { Annotation } from '../common/Annotation' ;
17- import { RunStatus } from '../common/RunStatus' ;
1817
1918@Injectable ( )
2019export class TeacherDataService extends DataService {
@@ -23,7 +22,6 @@ export class TeacherDataService extends DataService {
2322 currentWorkgroup = null ;
2423 currentStep = null ;
2524 previousStep = null ;
26- private runStatus : RunStatus = null ;
2725 periods = [ ] ;
2826 nodeGradingSort = 'team' ;
2927 studentGradingSort = 'step' ;
@@ -65,12 +63,6 @@ export class TeacherDataService extends DataService {
6563 this . addOrUpdateComponentState ( studentWork ) ;
6664 this . broadcastStudentWorkReceived ( { studentWork : studentWork } ) ;
6765 } ) ;
68-
69- this . ConfigService . configRetrieved$ . subscribe ( ( ) => {
70- if ( this . ConfigService . isClassroomMonitor ( ) ) {
71- this . retrieveRunStatus ( ) ;
72- }
73- } ) ;
7466 }
7567
7668 private handleAnnotationReceived ( annotation : Annotation ) : void {
@@ -396,19 +388,6 @@ export class TeacherDataService extends DataService {
396388 return - 1 ;
397389 }
398390
399- retrieveRunStatus ( ) : Observable < any > {
400- const options = {
401- params : new HttpParams ( ) . set ( 'runId' , this . ConfigService . getConfigParam ( 'runId' ) ) ,
402- headers : { 'Content-Type' : 'application/x-www-form-urlencoded' }
403- } ;
404- return this . http . get ( this . ConfigService . getConfigParam ( 'runStatusURL' ) , options ) . pipe (
405- tap ( ( runStatus : RunStatus ) => {
406- this . runStatus = runStatus ;
407- this . initializePeriods ( ) ;
408- } )
409- ) ;
410- }
411-
412391 getComponentStatesByWorkgroupId ( workgroupId ) {
413392 return this . studentData . componentStatesByWorkgroupId [ workgroupId ] || [ ] ;
414393 }
@@ -569,31 +548,6 @@ export class TeacherDataService extends DataService {
569548 }
570549 }
571550
572- private initializePeriods ( ) : void {
573- const periods = [ ...this . ConfigService . getPeriods ( ) ] ;
574- if ( this . currentPeriod == null ) {
575- this . setCurrentPeriod ( periods [ 0 ] ) ;
576- }
577- periods . unshift ( { periodId : - 1 , periodName : $localize `All Periods` } ) ;
578- let mergedPeriods = periods ;
579- if ( this . runStatus . periods != null ) {
580- mergedPeriods = this . mergeConfigAndRunStatusPeriods ( periods , this . runStatus . periods ) ;
581- }
582- this . periods = mergedPeriods ;
583- this . runStatus . periods = mergedPeriods ;
584- }
585-
586- private mergeConfigAndRunStatusPeriods ( configPeriods : any [ ] , runStatusPeriods : any [ ] ) : any [ ] {
587- const mergedPeriods = [ ] ;
588- configPeriods . forEach ( ( configPeriod ) => {
589- const runStatusPeriod = runStatusPeriods . find (
590- ( runStatusPeriod ) => runStatusPeriod . periodId === configPeriod . periodId
591- ) ;
592- mergedPeriods . push ( runStatusPeriod != null ? runStatusPeriod : configPeriod ) ;
593- } ) ;
594- return mergedPeriods ;
595- }
596-
597551 setCurrentPeriod ( period ) {
598552 const previousPeriod = this . currentPeriod ;
599553 this . currentPeriod = period ;
@@ -631,16 +585,12 @@ export class TeacherDataService extends DataService {
631585 return this . currentPeriod . periodId ;
632586 }
633587
634- getPeriods ( ) {
588+ getPeriods ( ) : any [ ] {
635589 return this . periods ;
636590 }
637591
638- getRunStatus ( ) : RunStatus {
639- return this . runStatus ;
640- }
641-
642- setRunStatus ( runStatus : RunStatus ) : void {
643- this . runStatus = runStatus ;
592+ setPeriods ( periods : any [ ] ) : void {
593+ this . periods = periods ;
644594 }
645595
646596 getVisiblePeriodsById ( currentPeriodId : number ) : any {
@@ -682,26 +632,6 @@ export class TeacherDataService extends DataService {
682632 return this . getPeriods ( ) . find ( ( period ) => period . periodId === periodId ) ;
683633 }
684634
685- saveRunStatus ( ) : Observable < void > {
686- const url = this . ConfigService . getConfigParam ( 'runStatusURL' ) ;
687- const body = new HttpParams ( )
688- . set ( 'runId' , this . ConfigService . getConfigParam ( 'runId' ) )
689- . set ( 'status' , JSON . stringify ( this . runStatus ) ) ;
690- const options = {
691- headers : { 'Content-Type' : 'application/x-www-form-urlencoded' }
692- } ;
693- return this . http . post < void > ( url , body , options ) ;
694- }
695-
696- createRunStatus ( ) : RunStatus {
697- const periods = this . ConfigService . getPeriods ( ) ;
698- periods . forEach ( ( period ) => ( period . paused = false ) ) ;
699- return {
700- runId : this . ConfigService . getConfigParam ( 'runId' ) ,
701- periods : periods
702- } ;
703- }
704-
705635 isWorkgroupShown ( workgroup ) : boolean {
706636 return (
707637 this . isWorkgroupInCurrentPeriod ( workgroup ) &&
0 commit comments