[SI-92] merge bugfixes

Signed-off-by: Peter Buschmann <peter.buschmann@pta.de>
diff --git a/projects/grid-failure-information-table-app/src/app/app.component.spec.ts b/projects/grid-failure-information-table-app/src/app/app.component.spec.ts
index cf5f136..4a119d2 100644
--- a/projects/grid-failure-information-table-app/src/app/app.component.spec.ts
+++ b/projects/grid-failure-information-table-app/src/app/app.component.spec.ts
@@ -26,14 +26,15 @@
     service = {
       loadGridFailureData: () => of(true),
     } as any;
-configService = {
+    configService = {
       getConfig: () => of(true),
-    } as any;   
- gridFailureMapListAll = [
+    } as any;
+    gridFailureMapListAll = [
       new GridFailure({ postcode: '007', modDate: '2020-08-13T13:35:44.808Z' }),
       new GridFailure({ postcode: '4711', modDate: '2020-08-14T13:35:44.808Z' }),
-      new GridFailure({ postcode: '0815', modDate: '2019-08-13T13:35:44.808Z' })];
-    component = new TableComponent(service, null);
+      new GridFailure({ postcode: '0815', modDate: '2019-08-13T13:35:44.808Z' }),
+    ];
+    component = new TableComponent(service, configService, null);
     (component as any)._gridFailuresAll = gridFailureMapListAll;
     component.gridFailures = gridFailureMapListAll.map(i => Object.assign(i));
   });
@@ -52,7 +53,7 @@
     let sortModel;
     let params = { api: { setSortModel: sortModel = {} } };
     component['_gridApi'] = params.api;
-    component['_datePipe'] = {transform: () => '18.09.2020 / 10:17'} as any;
+    component['_datePipe'] = { transform: () => '18.09.2020 / 10:17' } as any;
     const spy: any = spyOn(component['_gridApi'], 'setSortModel');
     component.onGridReady(params);
     expect(spy).toHaveBeenCalled();
@@ -60,6 +61,7 @@
 
   it('should assign all gridfailures to table', () => {
     component.postcode = '';
+    component['_datePipe'] = { transform: () => '18.09.2020 / 10:17' } as any;
     expect(component.gridFailures.length).toEqual(gridFailureMapListAll.length);
   });
 
@@ -74,13 +76,13 @@
     expect(lastTimeStamp).toEqual(1597412144808); // == '2020-08-14T13:35:44.808Z'
   });
 
-  it('should xxx', () => {
+  it('should define columnDefs in case config is provided', () => {
     let config = new Settings();
     config.visibilityConfiguration = { tableExternColumnVisibility: { failureClassification: 'show' } } as any;
     configService = {
       getConfig: () => of(config),
     } as any;
-    component = new TableComponent(service, configService);
+    component = new TableComponent(service, configService, null);
     component.ngOnInit();
     expect(component.columnDefs).toBeDefined();
   });
diff --git a/projects/grid-failure-information-table-app/src/app/app.component.ts b/projects/grid-failure-information-table-app/src/app/app.component.ts
index 6affdb4..36ff684 100644
--- a/projects/grid-failure-information-table-app/src/app/app.component.ts
+++ b/projects/grid-failure-information-table-app/src/app/app.component.ts
@@ -41,7 +41,7 @@
   private _gridFailuresAll: GridFailure[];
   private _subscription: Subscription = new Subscription();
 
-  constructor(private _appTableService: AppTableService, private _datePipe: DatePipe, configService: AppConfigService) {
+  constructor(private _appTableService: AppTableService, private _configService: AppConfigService, private _datePipe: DatePipe) {
     this.defaultColDef = {
       sortable: true,
       suppressMovable: true,
@@ -75,6 +75,7 @@
         .subscribe((data: GridFailure[]) => {
           this.gridFailures = data;
           this._gridFailuresAll = data;
+          this.lastModDate = this._datePipe.transform(this._getLastModeDate(), Globals.DATE_TIME_FORMAT);
         })
     );
     this.gridOptions = {
@@ -86,16 +87,15 @@
     this._gridApi = params.api;
     const sortModel = [{ colId: 'failureBegin', sort: 'desc' }];
     this._gridApi.setSortModel(sortModel);
-    this.lastModDate = this._datePipe.transform(this._getLastModeDate(), Globals.DATE_TIME_FORMAT);
   }
 
   ngOnDestroy(): void {
     this._subscription.unsubscribe();
   }
 
-  private _getLastModeDate(): number{
-    let modeDates:number[] = this.gridFailures.map(gf =>  Date.parse(gf.modDate));
-    modeDates = modeDates.sort((a,b) => b-a); // sort timestamps descending
+  private _getLastModeDate(): number {
+    let modeDates: number[] = this._gridFailuresAll.map(gf => Date.parse(gf.modDate));
+    modeDates = modeDates.sort((a, b) => b - a); // sort timestamps descending
     return modeDates[0];
   }
 }