Fix mistake when no results in manage

This commit is contained in:
Ricardo Montañana Gómez 2023-10-24 19:44:23 +02:00
parent 84cec0c1e0
commit a8f9800631
Signed by: rmontanana
GPG Key ID: 46064262FD9A7ADE
3 changed files with 11 additions and 6 deletions

View File

@ -75,7 +75,7 @@ namespace platform {
writeString(row, 4, "Hyperparameters", "bodyHeader"); writeString(row, 4, "Hyperparameters", "bodyHeader");
auto i = 0; auto i = 0;
string hyperparameters; string hyperparameters;
int hypSize = 0; int hypSize = 22;
map<string, string> files; // map of files imported and their tabs map<string, string> files; // map of files imported and their tabs
for (auto const& item : data.items()) { for (auto const& item : data.items()) {
row++; row++;

View File

@ -22,6 +22,10 @@ namespace platform {
} }
void ManageResults::doMenu() void ManageResults::doMenu()
{ {
if (results.empty()) {
cout << Colors::MAGENTA() << "No results found!" << Colors::RESET() << endl;
return;
}
results.sortDate(); results.sortDate();
list(); list();
menu(); menu();
@ -32,10 +36,6 @@ namespace platform {
} }
void ManageResults::list() void ManageResults::list()
{ {
if (results.empty()) {
cout << Colors::MAGENTA() << "No results found!" << Colors::RESET() << endl;
exit(0);
}
auto temp = ConfigLocale(); auto temp = ConfigLocale();
string suffix = numFiles != results.size() ? " of " + to_string(results.size()) : ""; string suffix = numFiles != results.size() ? " of " + to_string(results.size()) : "";
stringstream oss; stringstream oss;

View File

@ -1,12 +1,17 @@
#include "Results.h" #include "Results.h"
#include <algorithm> #include <algorithm>
#include <iostream>
namespace platform { namespace platform {
Results::Results(const string& path, const string& model, const string& score, bool complete, bool partial) : Results::Results(const string& path, const string& model, const string& score, bool complete, bool partial) :
path(path), model(model), scoreName(score), complete(complete), partial(partial) path(path), model(model), scoreName(score), complete(complete), partial(partial)
{ {
load(); load();
maxModel = (*max_element(files.begin(), files.end(), [](const Result& a, const Result& b) { return a.getModel().size() < b.getModel().size(); })).getModel().size(); if (!files.empty()) {
maxModel = (*max_element(files.begin(), files.end(), [](const Result& a, const Result& b) { return a.getModel().size() < b.getModel().size(); })).getModel().size();
} else {
maxModel = 0;
}
}; };
void Results::load() void Results::load()
{ {