Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SearchKit - Fix removing all related fields from SELECT when removing a JOIN #19747

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Mar 7, 2021

Overview

Fixes a small bug in SearchKit where not all columns get cleaned up when deleting a JOIN.

Before

  1. Search for Contacts
  2. Add GROUP BY id
  3. Add a join to Activity
  4. Activity subject will appear as a column
  5. Choose an aggregate function for the subject column (or click search and it will add one automatically)
  6. Delete the join to Activity

Result: the column is still there.

After

Repeat steps above.

Result: the column gets auto-deleted.

Technical Details

This bug wasn't causing a db error because the API silently ignores any unknown fields in the SELECT clause. So it was just annoying and confusing (even to Eileen).

@civibot
Copy link

civibot bot commented Mar 7, 2021

(Standard links)

@civibot civibot bot added the 5.36 label Mar 7, 2021
@colemanw
Copy link
Member Author

colemanw commented Mar 7, 2021

retest this please

@eileenmcnaughton
Copy link
Contributor

OK - I was able to replicate this and it is fixed on the demo site.

One thing I found confusing with demo data is that that the default activity join is on activity assignee & this it mostly unpopulated on the demo data. I suspect that even on real world data 'target' would be a better default

@eileenmcnaughton eileenmcnaughton merged commit a87f4bb into civicrm:5.36 Mar 7, 2021
@eileenmcnaughton eileenmcnaughton deleted the searchKitRemoveSelectWhenRemovingJoin branch March 7, 2021 21:11
@colemanw
Copy link
Member Author

colemanw commented Mar 7, 2021

@eileenmcnaughton thanks. I think the answer to that would be adjusting the weights in the "Activity Contacts" option group. SearchKit just defaults to the first option in a group.

@eileenmcnaughton
Copy link
Contributor

Ok - that's easy technically - I will create a gitlab & link in dev digest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants