mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-14 12:25:17 +00:00
Fix Filter section missing attribute (#2030)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
6c739dc935
commit
88597947f3
@ -31,11 +31,22 @@
|
|||||||
let current = 0
|
let current = 0
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
const hierarchy = client.getHierarchy()
|
const hierarchy = client.getHierarchy()
|
||||||
const targetClass = (hierarchy.getAttribute(_class, filter.key.key).type as RefTo<Doc>).to
|
|
||||||
|
function getTargetClass (): Ref<Class<Doc>> | undefined {
|
||||||
|
try {
|
||||||
|
return (hierarchy.getAttribute(_class, filter.key.key).type as RefTo<Doc>).to
|
||||||
|
} catch (err: any) {
|
||||||
|
console.error(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const targetClass = getTargetClass()
|
||||||
$: isState = targetClass === task.class.State ?? false
|
$: isState = targetClass === task.class.State ?? false
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
async function getCountStates (ids: Ref<Doc>[]): Promise<number> {
|
async function getCountStates (ids: Ref<Doc>[]): Promise<number> {
|
||||||
|
if (targetClass === undefined) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
const selectStates = await client.findAll(targetClass, { _id: { $in: Array.from(ids) } }, {})
|
const selectStates = await client.findAll(targetClass, { _id: { $in: Array.from(ids) } }, {})
|
||||||
const unique = new Set(selectStates.map((s) => (s as State).title))
|
const unique = new Set(selectStates.map((s) => (s as State).title))
|
||||||
return unique.size
|
return unique.size
|
||||||
|
Loading…
Reference in New Issue
Block a user