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

Filter advisory types and severity using AND operator and not OR #1467

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions dnf5/commands/advisory_shared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,16 @@ inline std::optional<libdnf5::advisory::AdvisoryQuery> advisory_query_from_cli_i
advisories |= advisories_names;
}

// Filter by advisory type
if (!advisory_types.empty()) {
auto advisories_types = libdnf5::advisory::AdvisoryQuery(base);
advisories_types.filter_type(advisory_types);
advisories |= advisories_types;
}

// Filter by advisory severity
if (!advisory_severities.empty()) {
auto advisories_severities = libdnf5::advisory::AdvisoryQuery(base);
advisories_severities.filter_severity(advisory_severities);
advisories |= advisories_severities;
// Filter by advisory severity and filter by advisory type using AND operator
if (!advisory_severities.empty() || !advisory_types.empty()) {
auto advisories_severities_and_types = libdnf5::advisory::AdvisoryQuery(base);
if (!advisory_severities.empty()) {
advisories_severities_and_types.filter_severity(advisory_severities);
}
if (advisory_types.empty()) {
advisories_severities_and_types.filter_type(advisory_types);
}
advisories |= advisories_severities_and_types;
}

// Filter by advisory bz
Expand Down
Loading