Add results to b_list

This commit is contained in:
2024-03-10 18:02:03 +01:00
parent 05d05e25c2
commit cd9ff89b52
9 changed files with 184 additions and 27 deletions

View File

@@ -14,6 +14,8 @@ namespace platform {
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))
{
results.load();
results.sortDate();
indexList = true;
openExcel = false;
workbook = NULL;

View File

@@ -4,14 +4,8 @@
namespace platform {
ResultsManager::ResultsManager(const std::string& model, const std::string& score, bool complete, bool partial) :
path(Paths::results()), model(model), scoreName(score), complete(complete), partial(partial)
path(Paths::results()), model(model), scoreName(score), complete(complete), partial(partial), maxModel(0)
{
load();
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 ResultsManager::load()
{
@@ -28,6 +22,7 @@ namespace platform {
files.push_back(result);
}
}
maxModel = std::max(size_t(5), (*max_element(files.begin(), files.end(), [](const Result& a, const Result& b) { return a.getModel().size() < b.getModel().size(); })).getModel().size());
}
void ResultsManager::hideResult(int index, const std::string& pathHidden)
{
@@ -48,12 +43,18 @@ namespace platform {
void ResultsManager::sortDate()
{
sort(files.begin(), files.end(), [](const Result& a, const Result& b) {
if (a.getDate() == b.getDate()) {
return a.getModel() < b.getModel();
}
return a.getDate() > b.getDate();
});
}
void ResultsManager::sortModel()
{
sort(files.begin(), files.end(), [](const Result& a, const Result& b) {
if (a.getModel() == b.getModel()) {
return a.getDate() > b.getDate();
}
return a.getModel() > b.getModel();
});
}
@@ -66,6 +67,9 @@ namespace platform {
void ResultsManager::sortScore()
{
sort(files.begin(), files.end(), [](const Result& a, const Result& b) {
if (a.getScore() == b.getScore()) {
return a.getDate() > b.getDate();
}
return a.getScore() > b.getScore();
});
}

View File

@@ -1,6 +1,5 @@
#pragma once
#include <map>
#include <vector>
#include <string>
#include <nlohmann/json.hpp>
@@ -10,6 +9,7 @@ namespace platform {
class ResultsManager {
public:
ResultsManager(const std::string& model, const std::string& score, bool complete, bool partial);
void load(); // Loads the list of results
void sortDate();
void sortScore();
void sortModel();
@@ -30,6 +30,5 @@ namespace platform {
bool partial;
int maxModel;
std::vector<Result> files;
void load(); // Loads the list of results
};
};