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

[#54459] Add AvailableProjectAttributesFilter to project queries to display the mapped projects list in projects attribute settings view #15400

Conversation

akabiru
Copy link
Member

@akabiru akabiru commented Apr 27, 2024

https://community.openproject.org/work_packages/54459

Wat?

Project Attributes are ProjectCustomFields, when they are activated within a project a mapping is created in the join table ProjectCustomFieldProjectMapping

How

Add a new filter that runs an inclusion search against ProjectCustomFieldProjectMapping join table, returning a list of projects where the given custom_field_ids values match

Example

query = Queries::Projects::ProjectQuery.new(name: "test") do |query|
  query.where(:available_project_attributes, '=', [13, 14])
end
query.results

app/models/project.rb Outdated Show resolved Hide resolved
app/models/queries/filters/strategies/list_contains.rb Outdated Show resolved Hide resolved
@akabiru akabiru requested a review from ulferts April 27, 2024 10:30
@akabiru akabiru self-assigned this Apr 27, 2024
@akabiru akabiru requested a review from Kharonus May 2, 2024 09:44
Copy link
Contributor

@ulferts ulferts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely worked through the whole mass of code that are the queries. It is quite something to stomach.

I added some remarks. Not all of them are actually must haves so let's talk when you are unsure.

app/models/project.rb Outdated Show resolved Hide resolved
app/models/queries/filters/strategies/list_contains.rb Outdated Show resolved Hide resolved
spec/support/queries/filters/shared_filter_examples.rb Outdated Show resolved Hide resolved
@akabiru akabiru force-pushed the task/54459-investigate-queries-and-filters-to-display-the-project-list-in-projects-attribute-settings-view branch from 2bd405c to 96ac329 Compare May 6, 2024 13:10
@akabiru akabiru marked this pull request as ready for review May 8, 2024 13:45
@akabiru akabiru requested review from ulferts and Kharonus May 8, 2024 13:45
@akabiru akabiru force-pushed the task/54459-investigate-queries-and-filters-to-display-the-project-list-in-projects-attribute-settings-view branch from dcd18b1 to 92d59bc Compare May 8, 2024 15:18
Copy link
Contributor

@ulferts ulferts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, @akabiru.

I have one remark but that is based on guesswork so feel free to ignore it.

app/models/projects/scopes/available_custom_fields.rb Outdated Show resolved Hide resolved
@akabiru akabiru merged commit 0da80c1 into dev May 15, 2024
11 checks passed
@akabiru akabiru deleted the task/54459-investigate-queries-and-filters-to-display-the-project-list-in-projects-attribute-settings-view branch May 15, 2024 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants