Skip to content

fix: update assignee query to handle empty names and improve description - #8

Merged
pikann merged 1 commit into
masterfrom
chore/update-preset-assignee-query
Sep 8, 2026
Merged

fix: update assignee query to handle empty names and improve description#8
pikann merged 1 commit into
masterfrom
chore/update-preset-assignee-query

Conversation

@pikann

@pikann pikann commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Problem

The "Open tasks by assignee" dashboard preset showed raw project_members UUIDs as chart labels instead of member names.

Fixes Paca-AI/paca#471

Root cause

The preset's SQL selected pm.id::text as the display label instead of resolving it to a name:

SELECT COALESCE(pm.id::text, 'Unassigned') AS assignee, ...

Fix

Resolve a real display name through both project_members paths:

  • Human members: users.full_name, falling back to users.username when full_name is blank (it's NOT NULL DEFAULT '', not nullable, so a plain COALESCE wouldn't have caught this — used NULLIF(full_name, '')).
  • Agent members: agents.name.
  • No assignee: still grouped under "Unassigned".
SELECT COALESCE(NULLIF(u.full_name, ''), u.username, a.name, 'Unassigned') AS assignee, ...
LEFT JOIN users u ON u.id = pm.user_id
LEFT JOIN agents a ON a.id = pm.agent_id
...
GROUP BY pm.id, u.full_name, u.username, a.name

Also dropped "(member id shown; ...)" from the preset description since it no longer applies.

Testing

Verified against the real schema rather than just by inspection: applied all services/api core migrations plus this plugin's own migrations to an isolated throwaway Postgres container, seeded fixture rows for a human member with a full name, a human member with a blank full name, an agent member, and an unassigned task, then ran the old vs. new query.

  • Old query: returned raw project_members UUIDs (reproduces the bug).
  • New query: returned Jane Doe, noname (username fallback), Review Bot (agent name), Unassigned — done tasks correctly excluded from counts.

tsc --noEmit passes; no other file in the repo references this preset's query text.

Note: this fixes the preset template for panels created going forward. It does not retroactively update dashboard panels that already saved the old query text (e.g. the reporter's existing panel) — those need the preset re-applied or the panel query edited by hand.

@pikann
pikann merged commit 20b3caf into master Sep 8, 2026
1 check passed
@pikann
pikann deleted the chore/update-preset-assignee-query branch September 8, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Ids instead of names in dashboard

1 participant