Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: TT-443 Use V2 for start timeEntry from timeClock
  • Loading branch information
gcobena-dev committed Dec 20, 2021
commit 7af6317b42ab013bb1ca8dc6b8d80b736af10a68
8 changes: 7 additions & 1 deletion src/app/modules/time-clock/services/entry.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ describe('EntryService', () => {

it('loads an activeEntry with /running', () => {
service.loadActiveEntry().subscribe();
let path = '';
if (service.showOptionInDevelopment){
path = `${service.baseUrl}}/running`;
}else{
path = `${service.baseUrl}/active/2`;
}

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

Expand Down
11 changes: 9 additions & 2 deletions src/app/modules/time-clock/services/entry.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TimeEntriesSummary } from '../models/time.entry.summary';
import { Injectable } from '@angular/core';
import { Injectable, Input } from '@angular/core';
import { HttpClient } from '@angular/common/http';

import { Observable } from 'rxjs';
Expand All @@ -19,9 +19,16 @@ export class EntryService {

static TIME_ENTRIES_DATE_TIME_FORMAT = 'yyyy-MM-ddTHH:mm:ssZZZZZ';
baseUrl = `${environment.timeTrackerApiUrl}/time-entries`;
@Input() showOptionInDevelopment: boolean;

loadActiveEntry(): Observable<any> {
return this.http.get(`${this.baseUrl}/running`);
let path = '';
if (this.showOptionInDevelopment){
path = `${this.baseUrl}/running`;
}else{
path = `${this.baseUrl}/active/2`;
}
return this.http.get(path);
}

loadEntries(date): Observable<any> {
Expand Down