add platform filter to b_manage

This commit is contained in:
2024-04-18 15:43:39 +02:00
parent a54d6b8716
commit 018c94bfe6
7 changed files with 18 additions and 9 deletions

View File

@@ -18,8 +18,8 @@
namespace platform {
const std::string STATUS_OK = "Ok.";
const std::string STATUS_COLOR = Colors::GREEN();
ManageScreen::ManageScreen(int rows, int cols, const std::string& model, const std::string& score, bool complete, bool partial, bool compare) :
rows{ rows }, cols{ cols }, complete{ complete }, partial{ partial }, compare{ compare }, didExcel(false), results(ResultsManager(model, score, complete, partial))
ManageScreen::ManageScreen(int rows, int cols, const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial, bool compare) :
rows{ rows }, cols{ cols }, complete{ complete }, partial{ partial }, compare{ compare }, didExcel(false), results(ResultsManager(model, score, platform, complete, partial))
{
results.load();
openExcel = false;

View File

@@ -14,7 +14,7 @@ namespace platform {
};
class ManageScreen {
public:
ManageScreen(int rows, int cols, const std::string& model, const std::string& score, bool complete, bool partial, bool compare);
ManageScreen(int rows, int cols, const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial, bool compare);
~ManageScreen() = default;
void doMenu();
private:

View File

@@ -3,8 +3,8 @@
#include "ResultsManager.h"
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), maxModel(0), maxTitle(0)
ResultsManager::ResultsManager(const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial) :
path(Paths::results()), model(model), scoreName(score), platform(platform), complete(complete), partial(partial), maxModel(0), maxTitle(0)
{
}
void ResultsManager::load()
@@ -17,7 +17,11 @@ namespace platform {
auto result = Result();
result.load(path, filename);
bool addResult = true;
if (model != "any" && result.getModel() != model || scoreName != "any" && scoreName != result.getScoreName() || complete && !result.isComplete() || partial && result.isComplete())
if (platform != "any" && result.getPlatform() != platform
|| model != "any" && result.getModel() != model
|| scoreName != "any" && scoreName != result.getScoreName()
|| complete && !result.isComplete()
|| partial && result.isComplete())
addResult = false;
if (addResult) {
files.push_back(result);

View File

@@ -18,7 +18,7 @@ namespace platform {
};
class ResultsManager {
public:
ResultsManager(const std::string& model, const std::string& score, bool complete, bool partial);
ResultsManager(const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial);
void load(); // Loads the list of results
void sortResults(SortField field, SortType type); // Sorts the list of results
void sortDate(SortType type);
@@ -38,6 +38,7 @@ namespace platform {
std::string path;
std::string model;
std::string scoreName;
std::string platform;
bool complete;
bool partial;
int maxModel;