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', () => {
105105 expect ( loadEntryRequest . request . params . get ( 'user_id' ) ) . toEqual ( '123' ) ;
106106 } ) ;
107107
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+
108120 it ( 'when restarting entry, a POST is triggered' , ( ) => {
109121 const entry = 'entryId' ;
110122
Original file line number Diff line number Diff line change @@ -58,12 +58,14 @@ export class EntryService {
5858 }
5959
6060 loadEntriesByTimeRange ( range : TimeEntriesTimeRange , userId : string ) : Observable < any > {
61+ const MAX_NUMBER_OF_ENTRIES_FOR_REPORTS = 9999 ;
6162 return this . http . get ( this . baseUrl ,
6263 {
6364 params : {
6465 start_date : this . datePipe . transform ( range . start_date , EntryService . TIME_ENTRIES_DATE_TIME_FORMAT ) ,
6566 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 } `
6769 }
6870 }
6971 ) ;
You can’t perform that action at this time.
0 commit comments