Skip to content

Commit 6d3120a

Browse files
authored
feat: TT-443 start time entry with time clock (#779)
* feat: TT-443 Use V2 for start timeEntry from timeClock * fix: TT-443 Test for start timeEntry from timeClock * fix: TT-443 Fix url in prod
1 parent 07f0766 commit 6d3120a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/app/modules/time-clock/services/entry.service.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,21 @@ describe('EntryService', () => {
4040
});
4141

4242
it('loads an activeEntry with /running', () => {
43+
service.urlInProduction = true;
4344
service.loadActiveEntry().subscribe();
4445

4546
const loadEntryRequest = httpMock.expectOne(`${service.baseUrl}/running`);
4647
expect(loadEntryRequest.request.method).toBe('GET');
4748
});
4849

50+
it('loads an activeEntry with /active/{userId}', () => {
51+
service.urlInProduction = false;
52+
service.loadActiveEntry().subscribe();
53+
54+
const loadEntryRequest = httpMock.expectOne(`${service.baseUrl}/active/2`);
55+
expect(loadEntryRequest.request.method).toBe('GET');
56+
});
57+
4958
it('loads summary with get /summary?time_offset=<time-offset>', () => {
5059
service.summary().subscribe();
5160
const timeOffset = new Date().getTimezoneOffset();

src/app/modules/time-clock/services/entry.service.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,17 @@ export class EntryService {
1919

2020
static TIME_ENTRIES_DATE_TIME_FORMAT = 'yyyy-MM-ddTHH:mm:ssZZZZZ';
2121
baseUrl = `${environment.timeTrackerApiUrl}/time-entries`;
22+
urlInProduction = environment.production;
2223

2324
loadActiveEntry(): Observable<any> {
24-
return this.http.get(`${this.baseUrl}/running`);
25+
let path = '';
26+
27+
if (this.urlInProduction){
28+
path = `${this.baseUrl}/running`;
29+
}else{
30+
path = `${this.baseUrl}/active/2`;
31+
}
32+
return this.http.get(path);
2533
}
2634

2735
loadEntries(date): Observable<any> {

0 commit comments

Comments
 (0)