Skip to content

Commit 9f275b2

Browse files
committed
fix: TT-117 two entries in progress bug
1 parent 8b5a239 commit 9f275b2

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/app/modules/time-entries/pages/time-entries.component.spec.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ describe('TimeEntriesComponent', () => {
247247
uri: 'abc',
248248
}, shouldRestartEntry: true
249249
};
250-
component.entryId = 'new-entry';
250+
component.entryId = 'entry_1';
251251
spyOn(injectedToastrService, 'error');
252252

253253
component.saveEntry(newEntry);
@@ -257,6 +257,7 @@ describe('TimeEntriesComponent', () => {
257257

258258
it('displays an error when end date of entry is greater than active entry start date', async () => {
259259
component.activeTimeEntry = entry;
260+
260261
const newEntry = {
261262
entry: {
262263
project_id: 'p-id',
@@ -267,7 +268,7 @@ describe('TimeEntriesComponent', () => {
267268
uri: 'abc',
268269
}, shouldRestartEntry: true
269270
};
270-
component.entryId = 'new-entry';
271+
component.entryId = 'entry_1';
271272
spyOn(injectedToastrService, 'error');
272273

273274
component.saveEntry(newEntry);
@@ -349,8 +350,9 @@ describe('TimeEntriesComponent', () => {
349350
expect(component.doSave).toHaveBeenCalledWith(entryToSave);
350351
}));
351352

352-
it('when event contains should restart as true, then a restart Entry action should be triggered', () => {
353+
it('when event contains should update as true, then a restart Entry action should be triggered', () => {
353354
component.entry = { start_date: new Date(), id: '1234', technologies: [], project_name: 'time-tracker' };
355+
354356
const entryToSave = {
355357
entry: {
356358
id: '123',
@@ -363,12 +365,13 @@ describe('TimeEntriesComponent', () => {
363365

364366
}, shouldRestartEntry: false
365367
};
368+
366369
component.entryId = '123';
367370
spyOn(store, 'dispatch');
368371

369372
component.doSave(entryToSave);
370373

371-
expect(store.dispatch).toHaveBeenCalledWith(new entryActions.RestartEntry(entryToSave.entry));
374+
expect(store.dispatch).toHaveBeenCalledWith(new entryActions.UpdateEntry(entryToSave.entry));
372375
});
373376

374377
it('should preload data of last entry when a project is selected while creating new entry ', waitForAsync(() => {

src/app/modules/time-entries/pages/time-entries.component.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,6 @@ export class TimeEntriesComponent implements OnInit, OnDestroy {
146146
if (this.entryId) {
147147
event.entry.id = this.entryId;
148148
this.store.dispatch(new entryActions.UpdateEntry(event.entry));
149-
if (event.shouldRestartEntry && this.entryId === this.activeTimeEntry.id) {
150-
this.store.dispatch(new entryActions.RestartEntry(event.entry));
151-
}
152149
} else {
153150
this.store.dispatch(new entryActions.CreateEntry(event.entry));
154151
}

0 commit comments

Comments
 (0)