diff --git a/package-lock.json b/package-lock.json
index 59358402b..ac683c952 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3696,7 +3696,8 @@
"camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
- "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
+ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
+ "dev": true
},
"camelcase-keys": {
"version": "6.2.2",
@@ -4946,7 +4947,8 @@
"decamelize": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
- "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
+ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
+ "dev": true
},
"decamelize-keys": {
"version": "1.1.0",
@@ -10405,7 +10407,8 @@
},
"decamelize": {
"version": "1.2.0",
- "bundled": true
+ "bundled": true,
+ "dev": true
},
"decode-uri-component": {
"version": "0.2.0",
@@ -13220,26 +13223,22 @@
"set-blocking": "^2.0.0",
"string-width": "^2.0.0",
"which-module": "^2.0.0",
- "y18n": "^3.2.1"
+ "y18n": "^3.2.1",
+ "yargs-parser": "^9.0.2"
},
"dependencies": {
- "camelcase": {
- "version": "5.3.1",
- "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
- "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
- },
"y18n": {
"version": "3.2.1",
"bundled": true,
"dev": true
},
"yargs-parser": {
- "version": "13.1.2",
- "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
- "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
+ "version": "9.0.2",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz",
+ "integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=",
+ "dev": true,
"requires": {
- "camelcase": "^5.0.0",
- "decamelize": "^1.2.0"
+ "camelcase": "^4.1.0"
}
}
}
@@ -19442,7 +19441,8 @@
"set-blocking": "^2.0.0",
"string-width": "^2.0.0",
"which-module": "^2.0.0",
- "y18n": "^3.2.1 || ^4.0.0"
+ "y18n": "^3.2.1 || ^4.0.0",
+ "yargs-parser": "^11.1.1"
},
"dependencies": {
"find-up": {
@@ -19487,18 +19487,19 @@
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
"dev": true
- },
- "yargs-parser": {
- "version": "13.1.2",
- "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
- "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
- "requires": {
- "camelcase": "^5.0.0",
- "decamelize": "^1.2.0"
- }
}
}
},
+ "yargs-parser": {
+ "version": "11.1.1",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz",
+ "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==",
+ "dev": true,
+ "requires": {
+ "camelcase": "^5.0.0",
+ "decamelize": "^1.2.0"
+ }
+ },
"yeast": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
diff --git a/src/app/modules/shared/components/details-fields/details-fields.component.html b/src/app/modules/shared/components/details-fields/details-fields.component.html
index ea5f5ddea..7c27d169a 100644
--- a/src/app/modules/shared/components/details-fields/details-fields.component.html
+++ b/src/app/modules/shared/components/details-fields/details-fields.component.html
@@ -4,13 +4,13 @@
Project
+
-
+
diff --git a/src/app/modules/shared/models/entry.model.ts b/src/app/modules/shared/models/entry.model.ts
index 1f8c958c0..66b862120 100644
--- a/src/app/modules/shared/models/entry.model.ts
+++ b/src/app/modules/shared/models/entry.model.ts
@@ -2,7 +2,7 @@ export interface Entry {
id: string;
start_date: Date;
end_date: Date;
- activity: string;
+ activity_id?: string;
technologies: string[];
comments?: string;
uri?: string;
@@ -15,4 +15,5 @@ export interface NewEntry {
description?: string;
technologies?: string[];
uri?: string;
+ activity_id?: string;
}
diff --git a/src/app/modules/shared/pipes/group-by-date/group-by-date.pipe.spec.ts b/src/app/modules/shared/pipes/group-by-date/group-by-date.pipe.spec.ts
index f734cc67c..b0d145527 100644
--- a/src/app/modules/shared/pipes/group-by-date/group-by-date.pipe.spec.ts
+++ b/src/app/modules/shared/pipes/group-by-date/group-by-date.pipe.spec.ts
@@ -20,7 +20,7 @@ describe('GroupByDatePipe', () => {
project: 'Mido - 05 de Febrero',
startDate: '2020-02-05T15:36:15.887Z',
endDate: '2020-02-05T18:36:15.887Z',
- activity: 'development',
+ activity_id: 'development',
technology: 'Angular, TypeScript',
comments: 'No comments',
ticket: 'EY-25',
@@ -30,7 +30,7 @@ describe('GroupByDatePipe', () => {
project: 'Mido 15 de Marzo',
startDate: '2020-03-15T20:36:15.887Z',
endDate: '2020-03-15T23:36:15.887Z',
- activity: 'development',
+ activity_id: 'development',
technology: 'Angular, TypeScript',
comments: 'No comments',
ticket: 'EY-38',
@@ -40,7 +40,7 @@ describe('GroupByDatePipe', () => {
project: 'GoSpace 15 y 16 de Marzo',
startDate: '2020-03-15T23:36:15.887Z',
endDate: '2020-03-16T05:36:15.887Z',
- activity: 'development',
+ activity_id: 'development',
technology: 'Angular, TypeScript',
comments: 'No comments',
ticket: 'EY-225',
@@ -50,7 +50,7 @@ describe('GroupByDatePipe', () => {
project: 'Mido 16 de Marzo',
startDate: '2020-03-16T15:36:15.887Z',
endDate: '2020-03-16T18:36:15.887Z',
- activity: 'development',
+ activity_id: 'development',
technology: 'Angular, TypeScript',
comments: 'No comments',
ticket: 'EY-89',
@@ -60,7 +60,7 @@ describe('GroupByDatePipe', () => {
project: 'Ernst&Young 01 de Abril',
startDate: '2020-04-01T09:36:15.887Z',
endDate: '2020-04-01T15:36:15.887Z',
- activity: 'development',
+ activity_id: 'development',
technology: 'Angular, TypeScript',
comments: 'No comments',
ticket: 'EY-59',
diff --git a/src/app/modules/time-clock/components/entry-fields/entry-fields.component.html b/src/app/modules/time-clock/components/entry-fields/entry-fields.component.html
index e843ccb66..a98b39fa7 100644
--- a/src/app/modules/time-clock/components/entry-fields/entry-fields.component.html
+++ b/src/app/modules/time-clock/components/entry-fields/entry-fields.component.html
@@ -3,8 +3,8 @@
Activity
-
diff --git a/src/app/modules/time-clock/components/entry-fields/entry-fields.component.spec.ts b/src/app/modules/time-clock/components/entry-fields/entry-fields.component.spec.ts
index 13a6d4ba6..1334c0f77 100644
--- a/src/app/modules/time-clock/components/entry-fields/entry-fields.component.spec.ts
+++ b/src/app/modules/time-clock/components/entry-fields/entry-fields.component.spec.ts
@@ -30,13 +30,14 @@ describe('EntryFieldsComponent', () => {
isLoading: false,
},
activities: {
- data: [{id: 'fc5fab41-a21e-4155-9d05-511b956ebd05', tenant_id: 'ioet', deleted: null, name: 'Training 2'}],
+ data: [{id: 'xyz', tenant_id: 'ioet', deleted: null, name: 'Training 2'}],
isLoading: false,
message: 'Data fetch successfully!',
activityIdToEdit: '',
},
entries: {
active: {
+ activity_id: 'xyz',
id: 'id-15',
project_id: 'project-id-15',
description: 'description for active entry',
@@ -49,6 +50,7 @@ describe('EntryFieldsComponent', () => {
};
const entry = {
+ activity_id: 'xyz',
id: 'id-15',
project_id: 'project-id-15',
description: 'description for active entry',
@@ -78,6 +80,7 @@ describe('EntryFieldsComponent', () => {
it('should set data in entryForm', () => {
const entryDataForm = {
+ activity_id: 'xyz',
description: 'description for active entry',
technologies: null,
uri: 'abc',
@@ -89,7 +92,7 @@ describe('EntryFieldsComponent', () => {
expect(component.entryForm.patchValue).toHaveBeenCalledTimes(1);
expect(component.entryForm.patchValue).toHaveBeenCalledWith(
- {description: entryDataForm.description, uri: entryDataForm.uri});
+ { description: entryDataForm.description, uri: entryDataForm.uri, activity_id: entryDataForm.activity_id });
expect(component.selectedTechnologies).toEqual([]);
});
diff --git a/src/app/modules/time-clock/components/entry-fields/entry-fields.component.ts b/src/app/modules/time-clock/components/entry-fields/entry-fields.component.ts
index 25125d997..a5d1682ce 100644
--- a/src/app/modules/time-clock/components/entry-fields/entry-fields.component.ts
+++ b/src/app/modules/time-clock/components/entry-fields/entry-fields.component.ts
@@ -28,7 +28,8 @@ export class EntryFieldsComponent implements OnInit {
constructor(private formBuilder: FormBuilder, private store: Store) {
this.entryForm = this.formBuilder.group({
description: '',
- uri: ''
+ uri: '',
+ activity_id: ''
});
}
@@ -48,6 +49,7 @@ export class EntryFieldsComponent implements OnInit {
id: this.activeEntry.id,
project_id: this.activeEntry.project_id,
uri: this.activeEntry.uri,
+ activity_id: this.activeEntry.activity_id,
};
}
});
@@ -58,6 +60,7 @@ export class EntryFieldsComponent implements OnInit {
this.entryForm.patchValue({
description: entryData.description,
uri: entryData.uri,
+ activity_id: entryData.activity_id,
});
if (entryData.technologies) {
this.selectedTechnologies = entryData.technologies;
diff --git a/src/app/modules/time-clock/store/entry.actions.spec.ts b/src/app/modules/time-clock/store/entry.actions.spec.ts
index 64535d610..21417bec9 100644
--- a/src/app/modules/time-clock/store/entry.actions.spec.ts
+++ b/src/app/modules/time-clock/store/entry.actions.spec.ts
@@ -60,7 +60,7 @@ describe('Actions for Entries', () => {
id: '1',
start_date: new Date(),
end_date: new Date(),
- activity: '',
+ activity_id: '',
technologies: ['abc', 'abc'],
});
expect(updateActiveEntrySuccess.type).toEqual(actions.EntryActionTypes.UPDATE_ACTIVE_ENTRY_SUCCESS);
diff --git a/src/app/modules/time-clock/store/entry.effects.ts b/src/app/modules/time-clock/store/entry.effects.ts
index 0cd82e565..01d174b54 100644
--- a/src/app/modules/time-clock/store/entry.effects.ts
+++ b/src/app/modules/time-clock/store/entry.effects.ts
@@ -56,7 +56,9 @@ export class EntryEffects {
mergeMap((entry) =>
this.entryService.createEntry(entry).pipe(
map((entryData) => {
- if (entryData.end_date !== null) {
+ if (entryData.end_date === null) {
+ this.toastrService.success('You clocked-in successfully');
+ } else {
this.toastrService.success(INFO_SAVED_SUCCESSFULLY);
}
return new actions.CreateEntrySuccess(entryData);
@@ -94,7 +96,6 @@ export class EntryEffects {
mergeMap((project) =>
this.entryService.updateActiveEntry(project).pipe(
map((projectData) => {
- this.toastrService.success(INFO_DELETE_SUCCESSFULLY);
return new actions.UpdateActiveEntrySuccess(projectData);
}),
catchError((error) => {
diff --git a/src/app/modules/time-clock/store/entry.reducer.spec.ts b/src/app/modules/time-clock/store/entry.reducer.spec.ts
index 7fb991895..301238c4d 100644
--- a/src/app/modules/time-clock/store/entry.reducer.spec.ts
+++ b/src/app/modules/time-clock/store/entry.reducer.spec.ts
@@ -64,7 +64,7 @@ describe('entryReducer', () => {
it('on LoadActiveEntrySuccess, activeEntryFound are saved in the store', () => {
const activeEntryFound: NewEntry[] = [
- { project_id: '123', description: 'description', technologies: ['angular', 'javascript'] },
+ { project_id: '123', description: 'description', technologies: ['angular', 'javascript'] , activity_id: 'xyz'},
];
const action = new actions.LoadActiveEntrySuccess(activeEntryFound);
const state = entryReducer(initialState, action);
@@ -94,7 +94,7 @@ describe('entryReducer', () => {
id: 'id',
start_date: new Date(),
end_date: new Date(),
- activity: 'activity',
+ activity_id: 'activity',
},
];
const action = new actions.LoadEntriesSuccess(entries);
@@ -151,7 +151,7 @@ describe('entryReducer', () => {
id: 'id',
start_date: new Date(),
end_date: new Date(),
- activity: 'activity',
+ activity_id: 'activity',
},
],
isLoading: false,
@@ -189,7 +189,7 @@ describe('entryReducer', () => {
id: 'id',
start_date: new Date(),
end_date: new Date(),
- activity: 'activity',
+ activity_id: 'activity',
},
],
isLoading: false,
@@ -202,7 +202,7 @@ describe('entryReducer', () => {
id: 'id',
start_date: new Date(),
end_date: new Date(),
- activity: '',
+ activity_id: '',
technologies: ['abc', 'abc'],
};
const action = new actions.UpdateActiveEntrySuccess(entryUpdated);
diff --git a/src/app/modules/time-entries/pages/time-entries.component.spec.ts b/src/app/modules/time-entries/pages/time-entries.component.spec.ts
index f083baca0..96cf546f2 100644
--- a/src/app/modules/time-entries/pages/time-entries.component.spec.ts
+++ b/src/app/modules/time-entries/pages/time-entries.component.spec.ts
@@ -54,7 +54,7 @@ describe('TimeEntriesComponent', () => {
project_id: 'abc',
start_date: new Date('2020-02-05T15:36:15.887Z'),
end_date: new Date('2020-02-05T18:36:15.887Z'),
- activity: 'development',
+ activity_id: 'development',
technologies: ['Angular', 'TypeScript'],
comments: 'No comments',
uri: 'EY-25',
@@ -99,18 +99,20 @@ describe('TimeEntriesComponent', () => {
}));
it('should call dataByMonth with data in ngOnInit()', async(() => {
- const newEntry = {
- id: 'entry_1',
+ const entryCurrentMonth = {
+ id: '1',
project_id: 'Mido - 05 de Febrero',
start_date: new Date(),
end_date: new Date(),
- activity: 'development',
+ activity_id: 'development',
technologies: ['Angular', 'TypeScript'],
comments: 'No comments',
uri: 'EY-25',
};
- mockEntriesSelector = store.overrideSelector(allEntries, [newEntry]);
+ mockEntriesSelector = store.overrideSelector(allEntries, [entryCurrentMonth]);
+
component.ngOnInit();
+
expect(component.dataByMonth.length).toEqual(1);
}));
@@ -120,7 +122,7 @@ describe('TimeEntriesComponent', () => {
project_id: 'Mido - 05 de Febrero',
start_date: new Date(),
end_date: null,
- activity: 'development',
+ activity_id: 'development',
technologies: ['Angular', 'TypeScript'],
comments: 'No comments',
uri: 'EY-25',
@@ -136,7 +138,7 @@ describe('TimeEntriesComponent', () => {
project_id: 'Mido - 05 de Febrero',
start_date: new Date('2020-02-05T15:36:15.887Z'),
end_date: new Date('2020-02-05T18:36:15.887Z'),
- activity: 'development',
+ activity_id: 'development',
technologies: ['Angular', 'TypeScript'],
comments: 'No comments',
uri: 'EY-25',