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
fix: #329 relading entries data after clock-in
  • Loading branch information
enriquezrene committed Jun 2, 2020
commit feaf17525728f64c0eee85a9a1054a273714c220
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,6 @@ export class ProjectListHoverComponent implements OnInit {
const newEntry = { project_id: selectedProject, start_date: new Date().toISOString() };
this.store.dispatch(new entryActions.CreateEntry(newEntry));
}
this.store.dispatch(new entryActions.LoadEntries(new Date().getMonth() + 1 ));
}
}
2 changes: 1 addition & 1 deletion src/app/modules/time-clock/store/entry.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const entryReducer = (state: EntryState = initialState, action: EntryActi
const entryList = [...state.entryList];
const index = entryList.findIndex((entry) => entry.id === action.payload.id);
entryList[index] = action.payload;
entryList.sort((a, b) => b.start_date.getTime() - a.start_date.getTime());
entryList.sort((a, b) => new Date(b.start_date).getTime() - new Date(a.start_date).getTime());
return {
...state,
isLoading: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class TimeEntriesComponent implements OnInit {
} else {
this.store.dispatch(new entryActions.CreateEntry(entry));
}
this.store.dispatch(new entryActions.LoadEntries(new Date().getMonth() + 1));
}

removeEntry(entryId: string) {
Expand Down