File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
src/app/modules/time-clock/services Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,18 @@ describe('EntryService', () => {
105
105
expect ( loadEntryRequest . request . params . get ( 'user_id' ) ) . toEqual ( '123' ) ;
106
106
} ) ;
107
107
108
+ it ( 'when getting time entries for report, limit parameter should be sent' , ( ) => {
109
+ const yesterday = moment ( new Date ( ) ) . subtract ( 1 , 'day' ) ;
110
+ const today = moment ( new Date ( ) ) ;
111
+ const timeRange : TimeEntriesTimeRange = { start_date : yesterday , end_date : today } ;
112
+ const userId = '123' ;
113
+
114
+ service . loadEntriesByTimeRange ( timeRange , userId ) . subscribe ( ) ;
115
+
116
+ const loadEntryRequest = httpMock . expectOne ( req => req . method === 'GET' && req . url === service . baseUrl ) ;
117
+ expect ( loadEntryRequest . request . params . get ( 'limit' ) ) . toEqual ( '9999' ) ;
118
+ } ) ;
119
+
108
120
it ( 'when restarting entry, a POST is triggered' , ( ) => {
109
121
const entry = 'entryId' ;
110
122
Original file line number Diff line number Diff line change @@ -58,12 +58,14 @@ export class EntryService {
58
58
}
59
59
60
60
loadEntriesByTimeRange ( range : TimeEntriesTimeRange , userId : string ) : Observable < any > {
61
+ const MAX_NUMBER_OF_ENTRIES_FOR_REPORTS = 9999 ;
61
62
return this . http . get ( this . baseUrl ,
62
63
{
63
64
params : {
64
65
start_date : this . datePipe . transform ( range . start_date , EntryService . TIME_ENTRIES_DATE_TIME_FORMAT ) ,
65
66
end_date : this . datePipe . transform ( range . end_date , EntryService . TIME_ENTRIES_DATE_TIME_FORMAT ) ,
66
- user_id : userId
67
+ user_id : userId ,
68
+ limit : `${ MAX_NUMBER_OF_ENTRIES_FOR_REPORTS } `
67
69
}
68
70
}
69
71
) ;
You can’t perform that action at this time.
0 commit comments