diff options
Diffstat (limited to 'src/discipline/Sport.h')
-rw-r--r-- | src/discipline/Sport.h | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/discipline/Sport.h b/src/discipline/Sport.h index 9c993fb..3b1c7f4 100644 --- a/src/discipline/Sport.h +++ b/src/discipline/Sport.h @@ -23,18 +23,46 @@ public: set<QString> getCategories(); QJsonArray getCompetitorsByCategory(QString category); - // chainable - QJsonObject filterByName(QJsonObject discipline, QString name); - QJsonObject filterByCountry(QJsonObject discipline, QString name); + // filter to change the current competitor array + void filterByName(QJsonArray& competitors, QString name); + void filterByCountry(QJsonArray& competitors, QString nocShort); + + // sort functions to change the order of the current competitor array + void sortByName(QJsonArray &competitors); + void sortByCountry(QJsonArray &competitors); + void sortByResult(QJsonArray &competitors); void setDiscipline(QJsonObject discipline) { - this->discipline = discipline; + this->discipline = QJsonObject(discipline); } private: + /* + * Analysis of provided competitor objects: + * + * Attributes: + * - code + * - noc (national olympics comittee) + * - name (sometimes the country name? mostly the competitors name) + * - order + * [- results] (only if the results are out!) + * + * + * Analysis of provided result objects: + * + * Attributes: + * - position + * - mark + * - medalType + * - irk + * [- winnerLoserTie] (only if provided in the discipline?) + */ QJsonObject discipline; + void filterCompetitors(QJsonArray& competitors, QString attribute, QString filter); + void sortCompetitors(QJsonArray &competitors, function<bool (const QJsonValue &left, const QJsonValue &right)> compare); + }; |