From 2a7cf0af2c0c1db02009f67f3b528d75f6cef36b Mon Sep 17 00:00:00 2001 From: Anton Brechka Date: Thu, 3 Nov 2022 15:52:16 +0700 Subject: [PATCH 1/2] Fixed multiple no sprint category Signed-off-by: Anton Brechka --- .../src/components/issues/IssuesList.svelte | 6 ++---- .../src/components/sprints/SprintSelector.svelte | 2 +- plugins/tracker-resources/src/utils.ts | 6 ++---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/plugins/tracker-resources/src/components/issues/IssuesList.svelte b/plugins/tracker-resources/src/components/issues/IssuesList.svelte index 04a970cb343..5bd5b0bcdc6 100644 --- a/plugins/tracker-resources/src/components/issues/IssuesList.svelte +++ b/plugins/tracker-resources/src/components/issues/IssuesList.svelte @@ -200,10 +200,8 @@ categoryLimit: Record ): Issue[] { const issues = groupes[category] ?? [] - if (Object.keys(groupes).length === 1) { - return issues.slice(0, singleCategoryLimit) - } - const limit = categoryLimit[toCat(category)] ?? defaultLimit + const initialLimit = Object.keys(groupes).length === 1 ? singleCategoryLimit : defaultLimit + const limit = categoryLimit[toCat(category)] ?? initialLimit return issues.slice(0, limit) } const categoryLimit: Record = {} diff --git a/plugins/tracker-resources/src/components/sprints/SprintSelector.svelte b/plugins/tracker-resources/src/components/sprints/SprintSelector.svelte index 71205e8e966..bebfa06eb7b 100644 --- a/plugins/tracker-resources/src/components/sprints/SprintSelector.svelte +++ b/plugins/tracker-resources/src/components/sprints/SprintSelector.svelte @@ -56,7 +56,7 @@ $: handleSelectedSprintIdUpdated(value, rawSprints) - $: translate(tracker.string.Sprint, {}).then((result) => (defaultSprintLabel = result)) + $: translate(tracker.string.NoSprint, {}).then((result) => (defaultSprintLabel = result)) const sprintIcon = tracker.icon.Sprint $: sprintText = shouldShowLabel ? selectedSprint?.label ?? defaultSprintLabel : undefined diff --git a/plugins/tracker-resources/src/utils.ts b/plugins/tracker-resources/src/utils.ts index 4edbc3c963a..0c7f54a62c4 100644 --- a/plugins/tracker-resources/src/utils.ts +++ b/plugins/tracker-resources/src/utils.ts @@ -111,7 +111,7 @@ export const getIssuesModificationDatePeriodTime = (period: IssuesDateModificati export const groupBy = (data: any, key: any): { [key: string]: any[] } => { return data.reduce((storage: { [key: string]: any[] }, item: any) => { - const group = item[key] + const group = item[key] ?? undefined storage[group] = storage[group] ?? [] @@ -320,9 +320,7 @@ export function getCategories ( const existingCategories = Array.from( new Set( - elements.map((x) => { - return (x as any)[key] - }) + elements.map((x: any) => x[key] ?? undefined) ) ) From 94ffacecabbf268a969deb0906612f42a5b03230 Mon Sep 17 00:00:00 2001 From: Anton Brechka Date: Thu, 3 Nov 2022 17:23:49 +0700 Subject: [PATCH 2/2] Fixed formatting Signed-off-by: Anton Brechka --- plugins/tracker-resources/src/utils.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/plugins/tracker-resources/src/utils.ts b/plugins/tracker-resources/src/utils.ts index 0c7f54a62c4..ba9157cefa0 100644 --- a/plugins/tracker-resources/src/utils.ts +++ b/plugins/tracker-resources/src/utils.ts @@ -318,11 +318,7 @@ export function getCategories ( (category) => statuses.find((status) => status.category === category)?._id ) - const existingCategories = Array.from( - new Set( - elements.map((x: any) => x[key] ?? undefined) - ) - ) + const existingCategories = Array.from(new Set(elements.map((x: any) => x[key] ?? undefined))) if (shouldShowAll) { if (key === 'status') {