Skip to content

Commit feaf175

Browse files
committed
fix: ioet#329 relading entries data after clock-in
1 parent 0726014 commit feaf175

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

src/app/modules/time-clock/components/project-list-hover/project-list-hover.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,6 @@ export class ProjectListHoverComponent implements OnInit {
6161
const newEntry = { project_id: selectedProject, start_date: new Date().toISOString() };
6262
this.store.dispatch(new entryActions.CreateEntry(newEntry));
6363
}
64+
this.store.dispatch(new entryActions.LoadEntries(new Date().getMonth() + 1 ));
6465
}
6566
}

src/app/modules/time-clock/store/entry.reducer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export const entryReducer = (state: EntryState = initialState, action: EntryActi
153153
const entryList = [...state.entryList];
154154
const index = entryList.findIndex((entry) => entry.id === action.payload.id);
155155
entryList[index] = action.payload;
156-
entryList.sort((a, b) => b.start_date.getTime() - a.start_date.getTime());
156+
entryList.sort((a, b) => new Date(b.start_date).getTime() - new Date(a.start_date).getTime());
157157
return {
158158
...state,
159159
isLoading: false,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export class TimeEntriesComponent implements OnInit {
6565
} else {
6666
this.store.dispatch(new entryActions.CreateEntry(entry));
6767
}
68+
this.store.dispatch(new entryActions.LoadEntries(new Date().getMonth() + 1));
6869
}
6970

7071
removeEntry(entryId: string) {

0 commit comments

Comments
 (0)