From 6030885fc3a4949e451372cdfb16c7e7dd9dbbf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana?= Date: Sat, 16 Sep 2023 17:27:18 +0200 Subject: [PATCH] Add partial result filter to manage --- src/Platform/Results.cc | 10 ++++++++-- src/Platform/Results.h | 3 ++- src/Platform/manage.cc | 7 ++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Platform/Results.cc b/src/Platform/Results.cc index 5ebb08a..3566ab7 100644 --- a/src/Platform/Results.cc +++ b/src/Platform/Results.cc @@ -42,7 +42,7 @@ namespace platform { if (filename.find(".json") != string::npos && filename.find("results_") == 0) { auto result = Result(path, filename); bool addResult = true; - if (model != "any" && result.getModel() != model || scoreName != "any" && scoreName != result.getScoreName() || complete && !result.isComplete()) + if (model != "any" && result.getModel() != model || scoreName != "any" && scoreName != result.getScoreName() || complete && !result.isComplete() || partial && result.isComplete()) addResult = false; if (addResult) files.push_back(result); @@ -66,8 +66,14 @@ namespace platform { { cout << Colors::GREEN() << "Results found: " << files.size() << endl; cout << "-------------------" << endl; + if (complete) { + cout << Colors::MAGENTA() << "Only listing complete results" << endl; + } + if (partial) { + cout << Colors::MAGENTA() << "Only listing partial results" << endl; + } auto i = 0; - cout << " # Date Model Score Name Score C/P Duration Title" << endl; + cout << Colors::GREEN() << " # Date Model Score Name Score C/P Duration Title" << endl; cout << "=== ========== ============ =========== =========== === ========= =============================================================" << endl; bool odd = true; for (const auto& result : files) { diff --git a/src/Platform/Results.h b/src/Platform/Results.h index bb9c68f..3f5655a 100644 --- a/src/Platform/Results.h +++ b/src/Platform/Results.h @@ -34,7 +34,7 @@ namespace platform { }; class Results { public: - Results(const string& path, const int max, const string& model, const string& score, bool complete) : path(path), max(max), model(model), scoreName(score), complete(complete) { load(); }; + Results(const string& path, const int max, const string& model, const string& score, bool complete, bool partial) : path(path), max(max), model(model), scoreName(score), complete(complete), partial(partial) { load(); }; void manage(); private: string path; @@ -42,6 +42,7 @@ namespace platform { string model; string scoreName; bool complete; + bool partial; bool indexList = true; vector files; void load(); // Loads the list of results diff --git a/src/Platform/manage.cc b/src/Platform/manage.cc index 8f55235..aec19e7 100644 --- a/src/Platform/manage.cc +++ b/src/Platform/manage.cc @@ -13,6 +13,7 @@ argparse::ArgumentParser manageArguments(int argc, char** argv) program.add_argument("-m", "--model").default_value("any").help("Filter results of the selected model)"); program.add_argument("-s", "--score").default_value("any").help("Filter results of the score name supplied"); program.add_argument("--complete").help("Show only results with all datasets").default_value(false).implicit_value(true); + program.add_argument("--partial").help("Show only partial results").default_value(false).implicit_value(true); try { program.parse_args(argc, argv); auto number = program.get("number"); @@ -22,6 +23,7 @@ argparse::ArgumentParser manageArguments(int argc, char** argv) auto model = program.get("model"); auto score = program.get("score"); auto complete = program.get("complete"); + auto partial = program.get("partial"); } catch (const exception& err) { cerr << err.what() << endl; @@ -38,7 +40,10 @@ int main(int argc, char** argv) auto model = program.get("model"); auto score = program.get("score"); auto complete = program.get("complete"); - auto results = platform::Results(platform::Paths::results(), number, model, score, complete); + auto partial = program.get("partial"); + if (complete) + partial = false; + auto results = platform::Results(platform::Paths::results(), number, model, score, complete, partial); results.manage(); return 0; }