Fix issues status order (#8095)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2025-02-25 21:48:59 +05:00 committed by GitHub
parent 3f3b3c5b29
commit c7cd7e2afa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,6 +39,7 @@ import { type IntlString } from '@hcengineering/platform'
import { createQuery, getClient, onClient } from '@hcengineering/presentation'
import task, { getStatusIndex, makeRank, type TaskType, type ProjectType } from '@hcengineering/task'
import {
selectedTaskTypeStore,
activeProjects as taskActiveProjects,
taskTypeStore,
typesOfJoinedProjectsStore
@ -162,6 +163,8 @@ export async function issueStatusSort (
const joinedTaskTypes = Array.from(taskTypes.values()).filter(
(taskType) => joinedProjectsTypes.includes(taskType.parent) && taskType.ofClass === tracker.class.Issue
)
const taskTypeId = get(selectedTaskTypeStore) ?? (joinedTaskTypes.length === 1 ? joinedTaskTypes[0]?._id : undefined)
const taskType = taskTypeId !== undefined ? taskTypes.get(taskTypeId) : undefined
const statuses = get(statusStore).byId
// TODO: How we track category updates.
@ -174,6 +177,11 @@ export async function issueStatusSort (
listIssueKanbanStatusOrder.indexOf(aVal?.category as Ref<StatusCategory>) -
listIssueKanbanStatusOrder.indexOf(bVal?.category as Ref<StatusCategory>)
if (res === 0) {
if (taskType != null) {
const aIndex = taskType.statuses.findIndex((p) => p === a)
const bIndex = taskType.statuses.findIndex((p) => p === b)
return aIndex - bIndex
}
if (type != null) {
const aIndex = getStatusIndex(type, taskTypes, a)
const bIndex = getStatusIndex(type, taskTypes, b)
@ -193,6 +201,11 @@ export async function issueStatusSort (
listIssueStatusOrder.indexOf(aVal?.category as Ref<StatusCategory>) -
listIssueStatusOrder.indexOf(bVal?.category as Ref<StatusCategory>)
if (res === 0) {
if (taskType != null) {
const aIndex = taskType.statuses.findIndex((p) => p === a)
const bIndex = taskType.statuses.findIndex((p) => p === b)
return aIndex - bIndex
}
if (type != null) {
const aIndex = getStatusIndex(type, taskTypes, a)
const bIndex = getStatusIndex(type, taskTypes, b)