From 68aa933548c0fb927d0d03c522e49ba361c0e294 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 30 Nov 2018 00:03:13 +0300 Subject: Fix unbuilt configuration counter calculation for builds page --- mod/mod-builds.cxx | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/mod/mod-builds.cxx b/mod/mod-builds.cxx index 30d3696..91a4aa6 100644 --- a/mod/mod-builds.cxx +++ b/mod/mod-builds.cxx @@ -93,7 +93,7 @@ transform (const string& s) template static inline query -build_query (const brep::cstrings& configs, +build_query (const brep::cstrings* configs, const brep::params::builds& params, const brep::optional& tenant, const brep::optional& archived) @@ -102,8 +102,8 @@ build_query (const brep::cstrings& configs, using query = query; using qb = typename query::build; - query q (!configs.empty () - ? qb::id.configuration.in_range (configs.begin (), configs.end ()) + query q (configs != nullptr + ? qb::id.configuration.in_range (configs->begin (), configs->end ()) : query (true)); const auto& pid (qb::id.package); @@ -445,10 +445,13 @@ handle (request& rq, response& rs) // We will not display hidden configurations, unless the configuration is // specified explicitly. // + bool exclude_hidden ( + params.configuration ().empty () || + params.configuration ().find_first_of ("*?") != string::npos); + cstrings conf_names; - if (params.configuration ().empty () || - params.configuration ().find_first_of ("*?") != string::npos) + if (exclude_hidden) { for (const auto& c: *build_conf_map_) { @@ -482,7 +485,7 @@ handle (request& rq, response& rs) using prep_query = prepared_query; query q (build_query ( - conf_names, params, tn, nullopt /* archived */)); + &conf_names, params, tn, nullopt /* archived */)); // Specify the portion. Note that we will be querying builds in chunks, // not to hold locks for too long. @@ -715,7 +718,9 @@ handle (request& rq, response& rs) // Filter by target. // - (tg.empty () || path_match (tg, c.target.string ()))) + (tg.empty () || path_match (tg, c.target.string ())) && + + (!exclude_hidden || belongs (c, "all"))) // Filter hidden. { configs.push_back (&c); @@ -750,7 +755,7 @@ handle (request& rq, response& rs) size_t ncur = build_db_->query_value ( build_query ( - conf_names, bld_params, tn, false /* archived */)); + &conf_names, bld_params, tn, false /* archived */)); // From now we will be using specific package name and version for each // build database query. @@ -777,10 +782,10 @@ handle (request& rq, response& rs) package_id_eq (bid.package, id) && bid.configuration == bld_query::_ref (config) && - // Note that the query already constrains the tenant via the build - // package id. + // Note that the query already constrains configurations via the + // configuration name and the tenant via the build package id. // - build_query (cstrings () /* configs */, + build_query (nullptr /* configs */, bld_params, nullopt /* tenant */, false /* archived */)); @@ -892,7 +897,7 @@ handle (request& rq, response& rs) // package id. // build_query ( - conf_names, bld_params, nullopt /* tenant */, false /* archived */)); + &conf_names, bld_params, nullopt /* tenant */, false /* archived */)); prep_bld_query bld_prep_query ( conn->prepare_query ("mod-builds-build-query", bq)); -- cgit v1.1