itat_challenge/src/model/CompetitorWithResults.cpp

16 lines
446 B
C++
Raw Normal View History

2024-08-12 22:09:50 +02:00
#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;
}