mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-19 14:55:31 +00:00
Fix done state filter (#3760)
Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
parent
c16970f357
commit
0154d7567e
@ -127,12 +127,19 @@
|
|||||||
const res: Map<Ref<Status>, string> = new Map()
|
const res: Map<Ref<Status>, string> = new Map()
|
||||||
for (const state of statuses) {
|
for (const state of statuses) {
|
||||||
if (res.has(state._id)) continue
|
if (res.has(state._id)) continue
|
||||||
space = await client.findOne(task.class.SpaceWithStates, { states: state._id })
|
const query = hierarchy.isDerived(state._class, task.class.DoneState)
|
||||||
|
? { doneStates: state._id }
|
||||||
|
: { states: state._id }
|
||||||
|
space = (await client.findOne(task.class.SpaceWithStates, query)) as SpaceWithStates | undefined
|
||||||
if (space === undefined) continue
|
if (space === undefined) continue
|
||||||
for (let index = 0; index < space.states.length; index++) {
|
const spaceStateArray = hierarchy.isDerived(state._class, task.class.DoneState)
|
||||||
const st = space.states[index]
|
? space.doneStates
|
||||||
const prev = index > 0 ? res.get(space.states[index - 1]) : undefined
|
: space.states
|
||||||
const next = index < space.states.length - 1 ? res.get(space.states[index + 1]) : undefined
|
if (spaceStateArray === undefined) continue
|
||||||
|
for (let index = 0; index < spaceStateArray.length; index++) {
|
||||||
|
const st = spaceStateArray[index]
|
||||||
|
const prev = index > 0 ? res.get(spaceStateArray[index - 1]) : undefined
|
||||||
|
const next = index < spaceStateArray.length - 1 ? res.get(spaceStateArray[index + 1]) : undefined
|
||||||
res.set(st, calcRank(prev ? { rank: prev } : undefined, next ? { rank: next } : undefined))
|
res.set(st, calcRank(prev ? { rank: prev } : undefined, next ? { rank: next } : undefined))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user