summaryrefslogtreecommitdiff
path: root/src/model/CompetitorWithResults.cpp
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/model/CompetitorWithResults.cpp
parentc539242efa11538e5e3f91bf3ff2f0de1c526bed (diff)
Created Model for competitors.
Diffstat (limited to 'src/model/CompetitorWithResults.cpp')
-rw-r--r--src/model/CompetitorWithResults.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/model/CompetitorWithResults.cpp b/src/model/CompetitorWithResults.cpp
new file mode 100644
index 0000000..d29441d
--- /dev/null
+++ b/src/model/CompetitorWithResults.cpp
@@ -0,0 +1,15 @@
+
+#include "CompetitorWithResults.h"
+
+bool CompetitorWithResults::setResults(const QJsonObject &results) {
+ if (!results.contains("mark")
+ || !results.contains("medalType")) {
+ throw invalid_argument("Results object of competitor is incomplete.");
+ }
+
+ this->results = {
+ {QString("mark"), results["mark"].toString()},
+ {QString("medalType"), results["medalType"].toString()}
+ };
+ return true;
+}