5
11
Fork
You've already forked tomato
1

Filtering events by users shows user emails if name is absent #36

Merged
edwardloveall merged 1 commit from el-better-blanks into main 2025年10月21日 20:26:52 +02:00

I missed this when sorting users the first time. Users with no full
name entered would show up as blank.

I also wanted to make sure that all the users that only had emails
didn't show up clumped up at the bottom or top. We ensure that users
always have some value in the full_name column, even if it's an empty
string. Postgres sorts empty strings to the top making all the no-name
users show up there. Here's the SQL:

SELECT*FROMusersORDERBYCOALESCE(NULLIF(full_name,''),email);

First, empty strings are treated as null (NULLIF). Then, if there is
no full_name, we use email (COALESCE).

I missed this when sorting users the first time. Users with no full name entered would show up as blank. I also wanted to make sure that all the users that only had emails didn't show up clumped up at the bottom or top. We ensure that users always have some value in the `full_name` column, even if it's an empty string. Postgres sorts empty strings to the top making all the no-name users show up there. Here's the SQL: ```sql SELECT * FROM users ORDER BY COALESCE(NULLIF(full_name, ''), email); ``` First, empty strings are treated as null (`NULLIF`). Then, if there is no `full_name`, we use `email` (`COALESCE`).
Filtering events by users shows user emails if name is absent
All checks were successful
Setup Successful
Jest Successful
Static Analysis Successful
RSpec Successful
9d1f953f32
I missed this when sorting users the first time. Users with no full
name entered would show up as blank.
I also wanted to make sure that all the users that only had emails
didn't show up clumped up at the bottom or top. We ensure that users
always have some value in the `full_name` column, even if it's an empty
string. Postgres sorts empty strings to the top making all the no-name
users show up there. Here's the SQL:
```sql
SELECT * FROM users ORDER BY COALESCE(NULLIF(full_name, ''), email);
```
First, empty strings are treated as null (`NULLIF`). Then, if there is
no `full_name`, we use `email` (`COALESCE`).
edwardloveall deleted branch el-better-blanks 2025年10月21日 20:26:52 +02:00
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rootable/tomato!36
Reference in a new issue
rootable/tomato
No description provided.
Delete branch "el-better-blanks"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?