@@ -8,6 +8,8 @@ import { Entry } from 'src/app/modules/shared/models';
88import { DataSource } from 'src/app/modules/shared/models/data-source.model' ;
99import { EntryState } from '../../../time-clock/store/entry.reducer' ;
1010import { getReportDataSource } from '../../../time-clock/store/entry.selectors' ;
11+ import { Moment } from 'moment' ;
12+ import { TotalHours } from '../../models/total-hours-report' ;
1113
1214@Component ( {
1315 selector : 'app-time-entries-table' ,
@@ -107,12 +109,13 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
107109 return column === durationColumnIndex ? moment . duration ( dataFormated ) . asHours ( ) . toFixed ( 2 ) : dataFormated ;
108110 }
109111
110- sumDates ( arrayData : Entry [ ] ) {
112+ sumDates ( arrayData : Entry [ ] ) : TotalHours {
111113
112114 let totalDaysInHours : number = 0 ;
113115 let totalHours : number = 0 ;
114116 let totalMinutes : number = 0 ;
115117 let totalSeconds : number = 0 ;
118+ let resultSum : TotalHours ;
116119
117120 arrayData . forEach ( entry => {
118121 let duration = this . getTimeDifference ( moment ( entry . end_date ) , moment ( entry . start_date ) ) ;
@@ -121,10 +124,11 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
121124 totalMinutes += duration . minutes ( ) ;
122125 totalSeconds += duration . seconds ( ) ;
123126
127+ console . log ( resultSum ) ;
124128
125- console . log ( `Horas: ${ totalHours } Minutos: ${ totalMinutes } Segundos: ${ totalSeconds } ` ) ;
126129
127130 } ) ;
131+ return resultSum ;
128132 }
129133
130134 getTimeDifference ( substractDate : moment . Moment , fromDate : moment . Moment ) : moment . Duration {
0 commit comments