diff --git a/src/app/features/worklog/util/get-complete-state-for-work-context.util.ts b/src/app/features/worklog/util/get-complete-state-for-work-context.util.ts index 1b674aa2e..6d97e0c73 100644 --- a/src/app/features/worklog/util/get-complete-state-for-work-context.util.ts +++ b/src/app/features/worklog/util/get-complete-state-for-work-context.util.ts @@ -1,6 +1,7 @@ import { WorkContext, WorkContextType } from '../../work-context/work-context.model'; import { Dictionary, EntityState } from '@ngrx/entity'; import { Task } from '../../tasks/task.model'; +import { ALL_TAG } from '../../tag/tag.const'; export const getCompleteStateForWorkContext = (workContext: WorkContext, taskState: EntityState, archive: EntityState): { completeStateForWorkContext: EntityState, @@ -40,13 +41,19 @@ const _filterIdsForProject = (state: EntityState, workContextId: string): } ); -const _filterIdsForTag = (state: EntityState, workContextId: string): string[] => (state.ids as string[]).filter( - id => { - const t = state.entities[id] as Task; - return !!(t.parentId) - ? (state.entities[t.parentId] as Task).tagIds.includes(workContextId) - : t.tagIds.includes(workContextId); - }); +const _filterIdsForTag = (state: EntityState, workContextId: string): string[] => { + if (workContextId === ALL_TAG.id) { + return state.ids as string[]; + } + + return (state.ids as string[]).filter( + id => { + const t = state.entities[id] as Task; + return !!(t.parentId) + ? (state.entities[t.parentId] as Task).tagIds.includes(workContextId) + : t.tagIds.includes(workContextId); + }); +}; const _limitStateToIds = (stateIn: EntityState, ids: string[]): Dictionary => { const newState: any = {};