summaryrefslogtreecommitdiff
path: root/src/discipline/Sport.h
diff options
context:
space:
mode:
authorSteru <jerrydream111@gmail.com>2024-08-12 22:09:50 +0200
committerSteru <jerrydream111@gmail.com>2024-08-12 22:09:50 +0200
commit94fb05a764c1d0d1f275f29ecd21686d835f9768 (patch)
tree283d60ee309ca35132c3cd64b55d018cc2cbfc87 /src/discipline/Sport.h
parentc539242efa11538e5e3f91bf3ff2f0de1c526bed (diff)
Created Model for competitors.
Diffstat (limited to 'src/discipline/Sport.h')
-rw-r--r--src/discipline/Sport.h92
1 files changed, 0 insertions, 92 deletions
diff --git a/src/discipline/Sport.h b/src/discipline/Sport.h
deleted file mode 100644
index 147f6e8..0000000
--- a/src/discipline/Sport.h
+++ /dev/null
@@ -1,92 +0,0 @@
-
-#ifndef ITAT_CHALLANGE_OLYMPICS_SPORT_H
-#define ITAT_CHALLANGE_OLYMPICS_SPORT_H
-
-
-#include <set>
-
-#include <QJsonObject>
-#include <QJsonDocument>
-#include <QString>
-
-using namespace std;
-
-
-class Sport {
-
-public:
-
- Sport(QJsonObject discipline) {
- this->discipline = discipline;
- }
-
- set<QString> getCategories();
- QJsonArray getCompetitorsByCategory(QString category);
- QJsonArray getCompetitorsWithMedal();
-
- // filter to change the current competitor array
- void lastName(QJsonArray &competitors);
- 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 reverseOrder(QJsonArray &competitors);
-
- // statistic function(s)
- void addRelativeToFirst(QJsonArray &competitors);
-
- void setDiscipline(QJsonObject 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?)
- *
- * Analysis of where to find the medal winners:
- *
- * Search for ... in category name.
- * - "Bronze"
- * - "Gold"
- * - "Final"
- *
- * ! ATTENTION !
- * When searching for "Final" there might be "Final A", "Final B", etc.
- * The results will only be in ONE of these categories!
- * -> which is good... cause then we can count occurences.
- */
- QJsonObject discipline;
-
- void filterCompetitors(QJsonArray &competitors, QString attribute, QString filter);
- void sortCompetitors(QJsonArray &competitors, function<bool (const QJsonValue &left, const QJsonValue &right)> compare);
-
- bool validateDiscipline();
- QJsonObject createCompetitorWithMedals(QJsonObject medalComp);
-
- float calcRelativeStat(QString ref, QString val);
-
-};
-
-
-#endif //ITAT_CHALLANGE_OLYMPICS_SPORT_H