From b48f5e4b39b31ef386f3f6db3dd1fc294f164fbd Mon Sep 17 00:00:00 2001 From: Alexey Zinoviev Date: Tue, 6 May 2025 08:27:06 +0400 Subject: [PATCH] UBERF-10499: Fix team planner (#8847) Signed-off-by: Alexey Zinoviev --- .../src/components/team/calendar/TeamCalendar.svelte | 7 ++----- server/postgres/src/storage.ts | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/time-resources/src/components/team/calendar/TeamCalendar.svelte b/plugins/time-resources/src/components/team/calendar/TeamCalendar.svelte index adb64b3622..d76dd69d0a 100644 --- a/plugins/time-resources/src/components/team/calendar/TeamCalendar.svelte +++ b/plugins/time-resources/src/components/team/calendar/TeamCalendar.svelte @@ -75,12 +75,10 @@ const client = getClient() function group ( - txMap: Map, Tx[]>, - persons: Ref[], + txes: Tx[], from: Timestamp, to: Timestamp ): { add: Map[] }>, change: Map[] }> } { - const txes = persons.flatMap((it) => txMap.get(it)) const add = new Map[] }>() const change = new Map[] }>() 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 txInfo = group(txes, persons, dayFrom, dayTo)} + {@const txInfo = group(txes.get(person) ?? [], dayFrom, dayTo)}
diff --git a/server/postgres/src/storage.ts b/server/postgres/src/storage.ts index 1c943786d0..bae4972ba2 100644 --- a/server/postgres/src/storage.ts +++ b/server/postgres/src/storage.ts @@ -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}`