Add message of not exist Best Results

This commit is contained in:
Ricardo Montañana Gómez 2023-09-20 13:50:34 +02:00
parent fc81730dfc
commit 8257a6ae39
Signed by: rmontanana
GPG Key ID: 46064262FD9A7ADE
5 changed files with 17 additions and 2 deletions

View File

@ -94,6 +94,8 @@ namespace platform {
ifstream resultData(Paths::results() + "/" + fileName); ifstream resultData(Paths::results() + "/" + fileName);
if (resultData.is_open()) { if (resultData.is_open()) {
bestResults = json::parse(resultData); bestResults = json::parse(resultData);
} else {
existBestFile = false;
} }
} }
try { try {
@ -101,7 +103,12 @@ namespace platform {
} }
catch (exception) { catch (exception) {
value = 1.0; value = 1.0;
} }
return value; return value;
} }
bool ReportBase::getExistBestFile()
{
return existBestFile;
}
} }

View File

@ -28,6 +28,7 @@ namespace platform {
json data; json data;
string fromVector(const string& key); string fromVector(const string& key);
string fVector(const string& title, const json& data, const int width, const int precision); string fVector(const string& title, const json& data, const int width, const int precision);
bool getExistBestFile();
virtual void header() = 0; virtual void header() = 0;
virtual void body() = 0; virtual void body() = 0;
virtual void showSummary() = 0; virtual void showSummary() = 0;
@ -35,10 +36,11 @@ namespace platform {
map<string, int> summary; map<string, int> summary;
double margin; double margin;
map<string, string> meaning; map<string, string> meaning;
bool compare;
private: private:
double bestResult(const string& dataset, const string& model); double bestResult(const string& dataset, const string& model);
bool compare;
json bestResults; json bestResults;
bool existBestFile = true;
}; };
}; };
#endif #endif

View File

@ -104,6 +104,9 @@ namespace platform {
oss << score << " compared to " << BestResult::title() << " .: " << totalScore / BestResult::score(); oss << score << " compared to " << BestResult::title() << " .: " << totalScore / BestResult::score();
cout << headerLine(oss.str()); cout << headerLine(oss.str());
} }
if (!getExistBestFile() && compare) {
cout << headerLine("*** Best Results File not found. Couldn't compare any result!");
}
cout << string(MAXL, '*') << endl << Colors::RESET(); cout << string(MAXL, '*') << endl << Colors::RESET();
} }
} }

View File

@ -326,5 +326,8 @@ namespace platform {
worksheet_merge_range(worksheet, row, 1, row, 5, (score + " compared to " + BestResult::title() + " .:").c_str(), efectiveStyle("text")); worksheet_merge_range(worksheet, row, 1, row, 5, (score + " compared to " + BestResult::title() + " .:").c_str(), efectiveStyle("text"));
writeDouble(row, 6, totalScore / BestResult::score(), "result"); writeDouble(row, 6, totalScore / BestResult::score(), "result");
} }
if (!getExistBestFile() && compare) {
worksheet_write_string(worksheet, row + 1, 0, "*** Best Results File not found. Couldn't compare any result!", styles["summaryStyle"]);
}
} }
} }

View File

@ -300,7 +300,7 @@ namespace platform {
if (openExcel) { if (openExcel) {
workbook_close(workbook); workbook_close(workbook);
} }
cout << "Done!" << endl; cout << Colors::RESET() << "Done!" << endl;
} }
} }