Add partial result filter to manage

This commit is contained in:
Ricardo Montañana Gómez 2023-09-16 17:27:18 +02:00
parent 89df7f4db0
commit 6030885fc3
Signed by: rmontanana
GPG Key ID: 46064262FD9A7ADE
3 changed files with 16 additions and 4 deletions

View File

@ -42,7 +42,7 @@ namespace platform {
if (filename.find(".json") != string::npos && filename.find("results_") == 0) { if (filename.find(".json") != string::npos && filename.find("results_") == 0) {
auto result = Result(path, filename); auto result = Result(path, filename);
bool addResult = true; 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; addResult = false;
if (addResult) if (addResult)
files.push_back(result); files.push_back(result);
@ -66,8 +66,14 @@ namespace platform {
{ {
cout << Colors::GREEN() << "Results found: " << files.size() << endl; cout << Colors::GREEN() << "Results found: " << files.size() << endl;
cout << "-------------------" << 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; 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; cout << "=== ========== ============ =========== =========== === ========= =============================================================" << endl;
bool odd = true; bool odd = true;
for (const auto& result : files) { for (const auto& result : files) {

View File

@ -34,7 +34,7 @@ namespace platform {
}; };
class Results { class Results {
public: 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(); void manage();
private: private:
string path; string path;
@ -42,6 +42,7 @@ namespace platform {
string model; string model;
string scoreName; string scoreName;
bool complete; bool complete;
bool partial;
bool indexList = true; bool indexList = true;
vector<Result> files; vector<Result> files;
void load(); // Loads the list of results void load(); // Loads the list of results

View File

@ -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("-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("-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("--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 { try {
program.parse_args(argc, argv); program.parse_args(argc, argv);
auto number = program.get<int>("number"); auto number = program.get<int>("number");
@ -22,6 +23,7 @@ argparse::ArgumentParser manageArguments(int argc, char** argv)
auto model = program.get<string>("model"); auto model = program.get<string>("model");
auto score = program.get<string>("score"); auto score = program.get<string>("score");
auto complete = program.get<bool>("complete"); auto complete = program.get<bool>("complete");
auto partial = program.get<bool>("partial");
} }
catch (const exception& err) { catch (const exception& err) {
cerr << err.what() << endl; cerr << err.what() << endl;
@ -38,7 +40,10 @@ int main(int argc, char** argv)
auto model = program.get<string>("model"); auto model = program.get<string>("model");
auto score = program.get<string>("score"); auto score = program.get<string>("score");
auto complete = program.get<bool>("complete"); auto complete = program.get<bool>("complete");
auto results = platform::Results(platform::Paths::results(), number, model, score, complete); auto partial = program.get<bool>("partial");
if (complete)
partial = false;
auto results = platform::Results(platform::Paths::results(), number, model, score, complete, partial);
results.manage(); results.manage();
return 0; return 0;
} }