mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-06 07:46:32 +00:00
Fix statuses sort (#3932)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
7da454355f
commit
eafc8f66de
@ -26,7 +26,7 @@
|
|||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import { Item, Kanban as KanbanUI } from '@hcengineering/kanban'
|
import { Item, Kanban as KanbanUI } from '@hcengineering/kanban'
|
||||||
import { getResource } from '@hcengineering/platform'
|
import { getResource } from '@hcengineering/platform'
|
||||||
import { createQuery, getClient, ActionContext } from '@hcengineering/presentation'
|
import { ActionContext, createQuery, getClient } from '@hcengineering/presentation'
|
||||||
import { Project, Task, TaskGrouping, TaskOrdering } from '@hcengineering/task'
|
import { Project, Task, TaskGrouping, TaskOrdering } from '@hcengineering/task'
|
||||||
import {
|
import {
|
||||||
ColorDefinition,
|
ColorDefinition,
|
||||||
@ -173,20 +173,15 @@
|
|||||||
if (viewOptions[viewOption.key] ?? viewOption.defaultValue) {
|
if (viewOptions[viewOption.key] ?? viewOption.defaultValue) {
|
||||||
const categoryAction = await getResource(categoryFunc.action)
|
const categoryAction = await getResource(categoryFunc.action)
|
||||||
|
|
||||||
const spaces = getCategorySpaces(categories)
|
let spaces = getCategorySpaces(categories)
|
||||||
if (space !== undefined) {
|
if (spaces.length === 0) {
|
||||||
spaces.push(space)
|
const set = new Set(docs.map((p) => p.space))
|
||||||
|
spaces = Array.from(set)
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await categoryAction(
|
const query = spaces.length > 0 ? { space: { $in: Array.from(spaces.values()) } } : space ? { space } : {}
|
||||||
_class,
|
|
||||||
spaces.length > 0 ? { space: { $in: Array.from(spaces.values()) } } : {},
|
const res = await categoryAction(_class, query, space, groupByKey, update, queryId, viewlet.descriptor)
|
||||||
space,
|
|
||||||
groupByKey,
|
|
||||||
update,
|
|
||||||
queryId,
|
|
||||||
viewlet.descriptor
|
|
||||||
)
|
|
||||||
if (res !== undefined) {
|
if (res !== undefined) {
|
||||||
categories = res
|
categories = res
|
||||||
break
|
break
|
||||||
|
@ -200,7 +200,6 @@ async function statusSort (
|
|||||||
const type = types.splice(index, 1)[0]
|
const type = types.splice(index, 1)[0]
|
||||||
for (let index = 0; index < type.statuses.length; index++) {
|
for (let index = 0; index < type.statuses.length; index++) {
|
||||||
const st = type.statuses[index]
|
const st = type.statuses[index]
|
||||||
if (!value.includes(st._id)) continue
|
|
||||||
const prev = index > 0 ? res.get(type.statuses[index - 1]._id) : prevRank
|
const prev = index > 0 ? res.get(type.statuses[index - 1]._id) : prevRank
|
||||||
const next = index < type.statuses.length - 1 ? res.get(type.statuses[index + 1]._id) : undefined
|
const next = index < type.statuses.length - 1 ? res.get(type.statuses[index + 1]._id) : undefined
|
||||||
const rank = calcRank(
|
const rank = calcRank(
|
||||||
|
Loading…
Reference in New Issue
Block a user