#1501 - Adding ability to exclude inactive projects when querying by tag

Signed-off-by: Steve Springett <steve@springett.us>
This commit is contained in:
Steve Springett 2022-03-30 10:55:12 -05:00
parent a53bcd7592
commit 87675e4f62
3 changed files with 14 additions and 8 deletions

View file

@ -227,10 +227,15 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
* @param tag the tag associated with the Project
* @return a List of Projects that contain the tag
*/
public PaginatedResult getProjects(final Tag tag, final boolean includeMetrics) {
public PaginatedResult getProjects(final Tag tag, final boolean includeMetrics, final boolean excludeInactive) {
final PaginatedResult result;
final Query<Project> query = pm.newQuery(Project.class);
final String queryFilter = "(tags.contains(:tag))";
final String queryFilter;
if (excludeInactive) {
queryFilter = "(tags.contains(:tag)) && (active == true || active == null))";
} else {
queryFilter = "(tags.contains(:tag))";
}
if (orderBy == null) {
query.setOrdering("name asc");
}
@ -254,7 +259,7 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
* @return a List of Projects that contain the tag
*/
public PaginatedResult getProjects(final Tag tag) {
return getProjects(tag, false);
return getProjects(tag, false, false);
}
/**