UBERF-10499: Fix team planner (#8847)

Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
Alexey Zinoviev 2025-05-06 08:27:06 +04:00 committed by GitHub
parent 70dc3f4387
commit b48f5e4b39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 6 deletions

View File

@ -75,12 +75,10 @@
const client = getClient()
function group (
txMap: Map<Ref<Person>, Tx[]>,
persons: Ref<Person>[],
txes: Tx[],
from: Timestamp,
to: Timestamp
): { add: Map<Asset, { count: number, tx: TxCUD<Doc>[] }>, change: Map<Asset, { count: number, tx: TxCUD<Doc>[] }> } {
const txes = persons.flatMap((it) => txMap.get(it))
const add = new Map<Asset, { count: number, tx: TxCUD<Doc>[] }>()
const change = new Map<Asset, { count: number, tx: TxCUD<Doc>[] }>()
const h = client.getHierarchy()
@ -153,8 +151,7 @@
{@const planned = gitem?.mappings.reduce((it, val) => it + val.total, 0) ?? 0}
{@const pevents = gitem?.events.reduce((it, val) => it + (val.dueDate - val.date), 0) ?? 0}
{@const busy = gitem?.busy.slots.reduce((it, val) => it + (val.dueDate - val.date), 0) ?? 0}
<!-- {@const accounts = personAccounts.filter((it) => it.person === person).map((it) => it._id)} -->
{@const txInfo = group(txes, persons, dayFrom, dayTo)}
{@const txInfo = group(txes.get(person) ?? [], dayFrom, dayTo)}
<div style:overflow="auto" style:height="{height}rem" class="p-1">
<div class="flex-row-center p-1">
<Icon icon={time.icon.Team} size={'small'} />

View File

@ -809,7 +809,7 @@ abstract class PostgresAdapterBase implements DbAdapter {
}
if (query.space === acc.uuid) return // TODO: was it for private spaces? If so, need to fix it as they are not identified by acc.uuid now
if (domain === DOMAIN_SPACE && isOwner(acc) && showArchived) return
const key = domain === DOMAIN_SPACE ? '_id' : domain === DOMAIN_TX ? "data ->> 'objectSpace'" : 'space'
const key = domain === DOMAIN_SPACE ? '_id' : domain === DOMAIN_TX ? '"objectSpace"' : 'space'
const privateCheck = domain === DOMAIN_SPACE ? ' OR sec.private = false' : ''
const archivedCheck = showArchived ? '' : ' AND sec.archived = false'
const q = `(sec.members @> '{"${acc.uuid}"}' OR sec."_class" = '${core.class.SystemSpace}'${privateCheck})${archivedCheck}`