Add message of Excel file created in b_manage
This commit is contained in:
@@ -13,21 +13,19 @@ namespace platform {
|
|||||||
const std::string STATUS_OK = "Ok.";
|
const std::string STATUS_OK = "Ok.";
|
||||||
const std::string STATUS_COLOR = Colors::GREEN();
|
const std::string STATUS_COLOR = Colors::GREEN();
|
||||||
ManageResults::ManageResults(int numFiles, const std::string& model, const std::string& score, bool complete, bool partial, bool compare) :
|
ManageResults::ManageResults(int numFiles, const std::string& model, const std::string& score, bool complete, bool partial, bool compare) :
|
||||||
numFiles{ numFiles }, complete{ complete }, partial{ partial }, compare{ compare }, results(ResultsManager(model, score, complete, partial))
|
numFiles{ numFiles }, complete{ complete }, partial{ partial }, compare{ compare }, didExcel(false), results(ResultsManager(model, score, complete, partial))
|
||||||
{
|
{
|
||||||
results.load();
|
results.load();
|
||||||
if (!results.empty()) {
|
results.sortDate();
|
||||||
results.sortDate();
|
sort_field = "Date";
|
||||||
indexList = true;
|
indexList = true;
|
||||||
openExcel = false;
|
openExcel = false;
|
||||||
workbook = NULL;
|
workbook = NULL;
|
||||||
if (numFiles == 0 or numFiles > results.size()) {
|
if (numFiles == 0 or numFiles > results.size()) {
|
||||||
this->numFiles = results.size();
|
this->numFiles = results.size();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
paginator = Paginator(numFiles, results.size());
|
paginator = Paginator(numFiles, results.size());
|
||||||
page = 1;
|
page = 1;
|
||||||
sort_field = "Date";
|
|
||||||
}
|
}
|
||||||
void ManageResults::doMenu()
|
void ManageResults::doMenu()
|
||||||
{
|
{
|
||||||
@@ -41,6 +39,9 @@ namespace platform {
|
|||||||
if (openExcel) {
|
if (openExcel) {
|
||||||
workbook_close(workbook);
|
workbook_close(workbook);
|
||||||
}
|
}
|
||||||
|
if (didExcel) {
|
||||||
|
std::cout << Colors::MAGENTA() << "Excel file created: " << Paths::excel() + Paths::excelResults() << std::endl;
|
||||||
|
}
|
||||||
std::cout << Colors::RESET() << "Done!" << std::endl;
|
std::cout << Colors::RESET() << "Done!" << std::endl;
|
||||||
}
|
}
|
||||||
void ManageResults::list(const std::string& status_message_init, const std::string& status_color, int index_A, int index_B)
|
void ManageResults::list(const std::string& status_message_init, const std::string& status_color, int index_A, int index_B)
|
||||||
@@ -51,7 +52,7 @@ namespace platform {
|
|||||||
int maxModel = results.maxModelSize();
|
int maxModel = results.maxModelSize();
|
||||||
int maxTitle = results.maxTitleSize();
|
int maxTitle = results.maxTitleSize();
|
||||||
std::vector<int> header_lengths = { 3, 10, maxModel, 10, 9, 3, 7, maxTitle };
|
std::vector<int> header_lengths = { 3, 10, maxModel, 10, 9, 3, 7, maxTitle };
|
||||||
int maxLine = std::accumulate(header_lengths.begin(), header_lengths.end(), 0) + header_lengths.size() - 1;
|
int maxLine = std::max(size_t(140), std::accumulate(header_lengths.begin(), header_lengths.end(), 0) + header_lengths.size() - 1);
|
||||||
auto temp = ConfigLocale();
|
auto temp = ConfigLocale();
|
||||||
auto [index_from, index_to] = paginator.getOffset(page);
|
auto [index_from, index_to] = paginator.getOffset(page);
|
||||||
std::string suffix = "";
|
std::string suffix = "";
|
||||||
@@ -61,8 +62,9 @@ namespace platform {
|
|||||||
if (partial) {
|
if (partial) {
|
||||||
suffix = " Only listing partial results ";
|
suffix = " Only listing partial results ";
|
||||||
}
|
}
|
||||||
std::string header = " " + std::to_string(index_to - index_from + 1) + " Results on screen - Page "
|
std::string header = " " + std::to_string(index_to - index_from + 1) + " Results on screen of "
|
||||||
+ std::to_string(page) + " of " + std::to_string(paginator.getPages()) + " ";
|
+ std::to_string(results.size()) + " - Page " + std::to_string(page) + " of "
|
||||||
|
+ std::to_string(paginator.getPages()) + " ";
|
||||||
|
|
||||||
std::string prefix = std::string(maxLine - suffix.size() - header.size(), ' ');
|
std::string prefix = std::string(maxLine - suffix.size() - header.size(), ' ');
|
||||||
std::cout << Colors::CLRSCR() << Colors::REVERSE() << Colors::WHITE() << header << prefix << Colors::MAGENTA() << suffix << std::endl;
|
std::cout << Colors::CLRSCR() << Colors::REVERSE() << Colors::WHITE() << header << prefix << Colors::MAGENTA() << suffix << std::endl;
|
||||||
@@ -136,12 +138,14 @@ namespace platform {
|
|||||||
auto data_B = results.at(index_B).getJson();
|
auto data_B = results.at(index_B).getJson();
|
||||||
ReportExcelCompared reporter(data_A, data_B);
|
ReportExcelCompared reporter(data_A, data_B);
|
||||||
reporter.report();
|
reporter.report();
|
||||||
|
didExcel = true;
|
||||||
return results.at(index_A).getFilename() + " Vs " + results.at(index_B).getFilename();
|
return results.at(index_A).getFilename() + " Vs " + results.at(index_B).getFilename();
|
||||||
}
|
}
|
||||||
std::string ManageResults::report(const int index, const bool excelReport)
|
std::string ManageResults::report(const int index, const bool excelReport)
|
||||||
{
|
{
|
||||||
auto data = results.at(index).getJson();
|
auto data = results.at(index).getJson();
|
||||||
if (excelReport) {
|
if (excelReport) {
|
||||||
|
didExcel = true;
|
||||||
ReportExcel reporter(data, compare, workbook);
|
ReportExcel reporter(data, compare, workbook);
|
||||||
reporter.show();
|
reporter.show();
|
||||||
openExcel = true;
|
openExcel = true;
|
||||||
|
@@ -21,6 +21,7 @@ namespace platform {
|
|||||||
int numFiles;
|
int numFiles;
|
||||||
bool indexList;
|
bool indexList;
|
||||||
bool openExcel;
|
bool openExcel;
|
||||||
|
bool didExcel;
|
||||||
bool complete;
|
bool complete;
|
||||||
bool partial;
|
bool partial;
|
||||||
bool compare;
|
bool compare;
|
||||||
|
@@ -7,7 +7,7 @@ public:
|
|||||||
Paginator() = default;
|
Paginator() = default;
|
||||||
Paginator(int pageSize, int total) : pageSize(pageSize), total(total)
|
Paginator(int pageSize, int total) : pageSize(pageSize), total(total)
|
||||||
{
|
{
|
||||||
numPages = (total + pageSize - 1) / pageSize;
|
numPages = pageSize > 0 ? (total + pageSize - 1) / pageSize : 0;
|
||||||
};
|
};
|
||||||
~Paginator() = default;
|
~Paginator() = default;
|
||||||
int getPageSize() const { return pageSize; }
|
int getPageSize() const { return pageSize; }
|
||||||
|
@@ -48,6 +48,8 @@ namespace platform {
|
|||||||
}
|
}
|
||||||
void ResultsManager::sortDate()
|
void ResultsManager::sortDate()
|
||||||
{
|
{
|
||||||
|
if (empty())
|
||||||
|
return;
|
||||||
sort(files.begin(), files.end(), [](const Result& a, const Result& b) {
|
sort(files.begin(), files.end(), [](const Result& a, const Result& b) {
|
||||||
if (a.getDate() == b.getDate()) {
|
if (a.getDate() == b.getDate()) {
|
||||||
return a.getModel() < b.getModel();
|
return a.getModel() < b.getModel();
|
||||||
@@ -57,6 +59,8 @@ namespace platform {
|
|||||||
}
|
}
|
||||||
void ResultsManager::sortModel()
|
void ResultsManager::sortModel()
|
||||||
{
|
{
|
||||||
|
if (empty())
|
||||||
|
return;
|
||||||
sort(files.begin(), files.end(), [](const Result& a, const Result& b) {
|
sort(files.begin(), files.end(), [](const Result& a, const Result& b) {
|
||||||
if (a.getModel() == b.getModel()) {
|
if (a.getModel() == b.getModel()) {
|
||||||
return a.getDate() > b.getDate();
|
return a.getDate() > b.getDate();
|
||||||
@@ -66,12 +70,16 @@ namespace platform {
|
|||||||
}
|
}
|
||||||
void ResultsManager::sortDuration()
|
void ResultsManager::sortDuration()
|
||||||
{
|
{
|
||||||
|
if (empty())
|
||||||
|
return;
|
||||||
sort(files.begin(), files.end(), [](const Result& a, const Result& b) {
|
sort(files.begin(), files.end(), [](const Result& a, const Result& b) {
|
||||||
return a.getDuration() > b.getDuration();
|
return a.getDuration() > b.getDuration();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
void ResultsManager::sortScore()
|
void ResultsManager::sortScore()
|
||||||
{
|
{
|
||||||
|
if (files.empty())
|
||||||
|
return;
|
||||||
sort(files.begin(), files.end(), [](const Result& a, const Result& b) {
|
sort(files.begin(), files.end(), [](const Result& a, const Result& b) {
|
||||||
if (a.getScore() == b.getScore()) {
|
if (a.getScore() == b.getScore()) {
|
||||||
return a.getDate() > b.getDate();
|
return a.getDate() > b.getDate();
|
||||||
|
Reference in New Issue
Block a user