results work now for DR as well.

This commit is contained in:
Dorian Zedler 2020-11-04 17:25:28 +01:00
parent 9b762ea246
commit 252f8dbfdd
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37
13 changed files with 248 additions and 160 deletions

View file

@ -34,6 +34,8 @@ public:
Q_INVOKABLE QList<BRRound*> getRounds() const;
Q_INVOKABLE QList<QObject*> getRoundsQML();
BRCategoryData getData();
private:
BRCategory(BRProvider* provider, BRWidget::BRFederation federation, int id, BRCategoryData initialData);
void setData(BRCategoryData data);
@ -48,6 +50,7 @@ signals:
void metadataChanged();
void currentRoundChanged();
void roundsChanged();
void resultsChanged();
};

View file

@ -24,6 +24,7 @@ class BRCompetition : public BRWidget
Q_PROPERTY(QList<QUrl> infosheetUrls READ getInfosheetUrls NOTIFY metadataChanged)
Q_PROPERTY(QList<QObject*> categories READ getCategoriesQML NOTIFY categoriesChanged)
Q_PROPERTY(BRCategory* currentCategory READ getCurrentCategory WRITE setCurrentCategory NOTIFY currentCategoryChanged)
Q_PROPERTY(QList<QObject*> results READ getResultsQML NOTIFY resultsChanged)
public:
friend class BRProvider;
@ -46,6 +47,7 @@ public:
QUrl eventWebsiteUrl;
QList<QUrl> infosheetUrls;
BRCategory* currentCategory;
QList<BRCategory*> categories;
} BRCompetitionData;
@ -60,8 +62,10 @@ public:
Q_INVOKABLE QUrl getEventWebsiteUrl();
Q_INVOKABLE QList<QUrl> getInfosheetUrls();
Q_INVOKABLE QList<QObject*> getCategoriesQML();
Q_INVOKABLE QList<BRCategory*> getCategories();
Q_INVOKABLE BRCategory* getCurrentCategory() const;
Q_INVOKABLE void setCurrentCategory(BRCategory* category);
Q_INVOKABLE QList<QObject*> getResultsQML();
static bool lessThan(BRCompetition* competition1, BRCompetition* competition2);
@ -89,6 +93,7 @@ signals:
void metadataChanged();
void categoriesChanged();
void currentCategoryChanged();
void resultsChanged();
};

View file

@ -44,12 +44,18 @@ protected:
virtual BRRound* getRound(BRWidget::BRFederation federation, int id, BRRound::BRRoundData initialData) final;
virtual BRResult* getResult(BRWidget::BRFederation federation, int id, BRResult::BRResultData initialData) final;
virtual void setCategoryData(BRCategory* category, BRCategory::BRCategoryData data) final {
category->setData(data);
}
virtual void setRoundData(BRRound* round, BRRound::BRRoundData data) final {
round->setData(data);
}
virtual BRWidget::BRWidgetStatusCode getWidgetData(BRCalendar::BRCalendarData* calendarData) = 0;
virtual BRWidget::BRWidgetStatusCode getWidgetData(BRSeason::BRSeasonData* seasonData) = 0;
virtual BRWidget::BRWidgetStatusCode getWidgetData(BRLeague::BRLeagueData* leagueData) = 0;
virtual BRWidget::BRWidgetStatusCode getWidgetData(BRCompetition::BRCompetitionData* competitionData) = 0;
virtual BRWidget::BRWidgetStatusCode getWidgetData(BRCategory::BRCategoryData* categoryData) = 0;
virtual BRWidget::BRWidgetStatusCode getWidgetData(BRRound::BRRoundData* roundData) = 0;
signals:

View file

@ -27,13 +27,9 @@ protected:
BRCup::BRCupData parseCupData(QVariantList categoriesList, QVariantMap rawData, BRWidget::BRFederation federation);
BRWidget::BRWidgetStatusCode getWidgetData(BRCategory::BRCategoryData* categoryData) override;
BRCategory::BRCategoryData parseCategoryData(QVariantMap rawData);
void parseCategoryData(BRCategory::BRCategoryData* categoryData, QVariantMap rawData);
BRWidget::BRWidgetStatusCode getWidgetData(BRRound::BRRoundData* roundData) override;
private:
QMap<BRWidget::BRFederation, QList<QVariantMap>> leagues;

View file

@ -25,11 +25,9 @@ protected:
BRCup::BRCupData parseCupData(QVariantMap rawData);
BRWidget::BRWidgetStatusCode getWidgetData(BRCategory::BRCategoryData* categoryData) override;
BRCategory::BRCategoryData parseCategoryData(QVariantMap rawData);
void parseCategoryData(BRCategory::BRCategoryData* categoryData, QVariantMap rawData);
BRWidget::BRWidgetStatusCode getWidgetData(BRRound::BRRoundData* roundData) override;
BRRound::BRRoundData parseRoundData(QVariantMap rawData);
void parseRoundData(BRRound::BRRoundData* roundData, QVariantMap rawData);

View file

@ -31,6 +31,7 @@ public:
Q_INVOKABLE QString getName();
Q_INVOKABLE QList<QObject*> getResultsQML();
BRRoundData getData();
private:
BRRound(BRProvider* provider, BRWidget::BRFederation federation, int id, BRRoundData initialData);

View file

@ -31,7 +31,7 @@ BRWidgetPage {
ready: true
title: data.name
titleIsPageTitle: true
subTitle: data.currentCategory.name + " " + qsTr("(Results)")
subTitle: data.currentCategory.currentRound.name + " " + data.currentCategory.name + " " + qsTr("(Results)")
headerComponent: RowLayout {
id: headerComponent
@ -74,6 +74,7 @@ BRWidgetPage {
}
onLoadingFinished: {
return;
if(resultLv.model.length > 0){
control.ready = true
control.status = 200
@ -91,7 +92,7 @@ BRWidgetPage {
if(data.task === "category"){
loadingDl.open()
control.data.currentCategory = data.category
control.data.currentCategory.load()
control.data.load()
loadingDl.close()
}
else if(data.task === "season"){
@ -121,8 +122,8 @@ BRWidgetPage {
function changeRound(round) {
loadingDl.open()
round.load()
control.data.currentCategory.currentRound = round
control.data.load()
loadingDl.close()
}
@ -134,7 +135,7 @@ BRWidgetPage {
model: control.data.currentCategory.currentRound.results
onRefresh: {
control.data.currentCategory.load()
control.data.load()
}
/* TODO onWidgetDataChanged: {
@ -151,15 +152,6 @@ BRWidgetPage {
}
}*/
Connections {
target: selector
onSelectionFinished: {
if(data.cat !== undefined){
updateData({cat: data.cat}, true)
}
}
}
onContentYChanged: {
if(contentY > 0 && speedFlowChartBackgroundRect.state === "visible"){
resultLv.positionViewAtBeginning()
@ -687,17 +679,15 @@ BRWidgetPage {
delegate: TabButton {
text: modelData.name
width: Math.max(150, routeSelectTb.width / routeSelectButtonRep.model) //text.length * font.pixelSize
width: Math.max(150, routeSelectTb.width / routeSelectButtonRep.model.length) //text.length * font.pixelSize
onWidthChanged: {
console.log("WIDTH IS: " + Math.max(150, routeSelectTb.width / routeSelectButtonRep.model.length))
}
onClicked: {
//console.log("changing to index: " + index + " (" + routeSelectTb.tabs[index][0] + ", " + routeSelectTb.tabs[index][1] + ")")
control.changeRound(modelData)
return;
if(routeSelectTb.getIndex(parseInt(control.widgetData['route_order'])) !== index){
control.changeRoute(routeSelectTb.tabs[index][0])
routeSelectTb.setCurrentIndex(routeSelectTb.getIndex(parseInt(control.widgetData['route_order'])))
}
}
}
}

View file

@ -432,7 +432,9 @@ Window {
function openWidget(params){
loadingDl.open()
console.log("OPENING COMP 2")
var calComp = Qt.createComponent("qrc:/Pages/WidgetPage.qml").createObject(null, {"params": params})
console.log("OPENING COMP 3")
app.errorCode = calComp.status
if(calComp.ready){

View file

@ -1,5 +1,6 @@
#include "../headers/brcategory.h"
#include "headers/brprovider.h"
#include "headers/brcompetition.h"
BRCategory::BRCategory(BRProvider* provider, BRWidget::BRFederation federation, int id, BRCategoryData initialData) : BRWidget(provider, federation, id)
{
@ -35,6 +36,17 @@ QList<QObject*> BRCategory::getRoundsQML() {
return this->listToQmlList(this->rounds);
}
BRCategory::BRCategoryData BRCategory::getData() {
BRCategory::BRCategoryData data {
this,
this->name,
this->currentRound,
this->rounds
};
return data;
}
void BRCategory::setData(BRCategoryData data) {
this->name = data.name;
emit this->metadataChanged();
@ -48,8 +60,10 @@ void BRCategory::setData(BRCategoryData data) {
this->rounds.clear();
this->rounds = data.rounds;
for(BRRound* round : this->rounds)
for(BRRound* round : this->rounds) {
round->category = this;
connect(round, &BRRound::resultsChanged, this, &BRCategory::resultsChanged);
}
emit this->roundsChanged();
}
@ -57,21 +71,5 @@ void BRCategory::setData(BRCategoryData data) {
BRWidget::BRWidgetStatusCode BRCategory::load() {
BRCategoryData newData {
this,
this->name,
this->currentRound,
this->rounds
};
qDebug() << "LOADING CATEGORY";
BRWidget::BRWidgetStatusCode statusCode = this->getProvider()->getWidgetData(&newData);
if(statusCode != BRWidget::Success)
return statusCode;
this->setData(newData);
return BRWidget::Success;
return BRWidget::OpeationNotSupportedError;
}

View file

@ -54,6 +54,9 @@ QList<QObject*> BRCompetition::getCategoriesQML() {
return this->listToQmlList(this->categories);
}
QList<BRCategory*> BRCompetition::getCategories() {
return this->categories;
}
BRCategory* BRCompetition::getCurrentCategory() const {
return this->currentCategory;
@ -77,6 +80,13 @@ void BRCompetition::setCurrentCategory(BRCategory* category) {
emit this->currentCategoryChanged();
}
QList<QObject*> BRCompetition::getResultsQML() {
if(this->currentCategory == nullptr || this->currentCategory->getCurrentRound() == nullptr)
return {};
return this->currentCategory->getCurrentRound()->getResultsQML();
}
BRWidget::BRWidgetStatusCode BRCompetition::load() {
BRCompetitionData newData {
this,
@ -87,6 +97,7 @@ BRWidget::BRWidgetStatusCode BRCompetition::load() {
this->eventWebsiteUrl,
this->infosheetUrls,
this->currentCategory,
this->categories
};
@ -109,11 +120,18 @@ void BRCompetition::setData(BRCompetition::BRCompetitionData data) {
this->infosheetUrls = data.infosheetUrls;
emit this->metadataChanged();
if(this->currentCategory != data.currentCategory) {
this->currentCategory = data.currentCategory;
emit this->currentCategoryChanged();
}
if(this->categories != data.categories) {
this->categories.clear();
this->categories = data.categories;
for(BRCategory* category : this->categories)
for(BRCategory* category : this->categories) {
category->competition = this;
connect(category, &BRCategory::resultsChanged, this, &BRCompetition::resultsChanged);
}
emit this->categoriesChanged();
}

View file

@ -203,42 +203,54 @@ BRLeague::BRLeagueData BRProviderDr::parseLeagueData(QVariantMap leaguePropertie
BRWidget::BRWidgetStatusCode BRProviderDr::getWidgetData(BRCompetition::BRCompetitionData* competitionData) {
if(competitionData->competition->getCurrentCategory() == nullptr)
return BRWidget::NotImplementedError;
return BRWidget::OpeationNotSupportedError;
return competitionData->competition->getCurrentCategory()->load();
// reload all data
BRCategory* currentCategory = competitionData->competition->getCurrentCategory();
// load category data
QString competitionId = QString::number(currentCategory->getCompetition()->getId());
QString categoryId = QString::number(currentCategory->getId());
QString requestUrl = "https://www.digitalrock.de/egroupware/ranking/json.php?comp=" + competitionId + "&cat=" + categoryId;
if(currentCategory->getCurrentRound() != nullptr)
requestUrl += "&route=" + QString::number(currentCategory->getCurrentRound()->getId());
QVariantMap ret = this->serverRequest(QUrl(requestUrl));
if(ret["status"] != 200){
// request was a failure
return BRWidget::BRWidgetStatusCode(ret["status"].toInt());
}
QVariantMap data = QJsonDocument::fromJson(ret["text"].toString().toUtf8()).toVariant().toMap();
this->parseCompetitionData(competitionData, data, competitionData->competition->getFederation());
return BRWidget::Success;
}
BRCompetition::BRCompetitionData BRProviderDr::parseCompetitionData(QVariantMap rawData, BRWidget::BRFederation federation) {
// Load competition data from calendar
BRCompetition::BRCompetitionData data;
this->parseCompetitionData(&data, rawData, federation);
return data;
}
void BRProviderDr::parseCompetitionData(BRCompetition::BRCompetitionData* competitionData, QVariantMap rawData, BRWidget::BRFederation federation) {
QMap<QString, BRCompetition::BRDiscipline> disciplineTranslations = {
{"boulder", BRCompetition::Boulder},
{"lead", BRCompetition::Lead},
{"speed", BRCompetition::Speed}
};
if(rawData.contains("name"))
competitionData->name = rawData["name"].toString();
else if(rawData.contains("comp_name"))
competitionData->name = rawData["comp_name"].toString();
data.name = rawData["name"].toString();
if(disciplineTranslations.contains(rawData["discipline"].toString()))
competitionData->discipline = disciplineTranslations[rawData["discipline"].toString()];
data.discipline = disciplineTranslations[rawData["discipline"].toString()];
if(rawData.contains("date"))
competitionData->startDate = QDate::fromString(rawData["date"].toString(), "yyyy-MM-dd");
data.startDate = QDate::fromString(rawData["date"].toString(), "yyyy-MM-dd");
if(rawData.contains("date_end"))
competitionData->endDate = QDate::fromString(rawData["date_end"].toString(), "yyyy-MM-dd");
data.endDate = QDate::fromString(rawData["date_end"].toString(), "yyyy-MM-dd");
if(rawData.contains("hompage"))
competitionData->eventWebsiteUrl = rawData["homepage"].toString();
data.eventWebsiteUrl = rawData["homepage"].toString();
// load infosheet URLs
for(int i = 0; i < 2; i++) {
@ -247,36 +259,117 @@ void BRProviderDr::parseCompetitionData(BRCompetition::BRCompetitionData* compet
QString url = rawData[infosheetName].toString();
if(federation == BRWidget::DAV)
url = "http://ranking.alpenverein.de/" + QString::number(competitionData->startDate.year()) + "/GER/" + rawData["rkey"].toString() + ".pdf";
url = "http://ranking.alpenverein.de/" + QString::number(data.startDate.year()) + "/GER/" + rawData["rkey"].toString() + ".pdf";
competitionData->infosheetUrls.append(url);
data.infosheetUrls.append(url);
}
}
// load categories
QVariantList categoriesList;
if(rawData.contains("cats")) {
// we are loading calendar data!
QVariantList categoriesList = rawData["cats"].toList();
competitionData->categories.clear();
for(QVariant categoryVar : categoriesList) {
BRCategory::BRCategoryData categoryData;
categoryData.name = rawData["name"].toString();
BRCategory* category = this->getCategory(federation, rawData["GrpId"].toInt(), categoryData);
competitionData->categories.append(category);
QVariantList categoriesList = rawData["cats"].toList();
data.categories.clear();
for(QVariant categoryVar : categoriesList) {
BRCategory::BRCategoryData categoryData;
categoryData.currentRound = nullptr;
categoryData.name = categoryVar.toMap()["name"].toString();
BRCategory* category = this->getCategory(federation, categoryVar.toMap()["GrpId"].toInt(), categoryData);
data.categories.append(category);
}
data.currentCategory = nullptr;
return data;
}
void BRProviderDr::parseCompetitionData(BRCompetition::BRCompetitionData* competitionData, QVariantMap rawData, BRWidget::BRFederation federation) {
// load competition data from category page (?comp=X&cat=Y)
competitionData->name = rawData["comp_name"].toString();
// reload categories
// As digitalrock does not allow to get rounds in the competiton calendar
// we need to populate all categories with their rounds when the first category is loaded.
// for that, all categories are recreated
QVariantList categoriesList = rawData["categorys"].toList();
// delete old categories
for(BRCategory* category : competitionData->categories)
category->deleteLater();
competitionData->categories.clear();
for(QVariant categoryVar : categoriesList) {
QVariantMap categoryMap = categoryVar.toMap();
BRCategory::BRCategoryData categoryData;
categoryData.name = categoryMap["name"].toString();
categoryData.currentRound = nullptr;
qDebug() << "Loading category: " << categoryData.name;
QVariantMap roundList = rawData["route_names"].toMap();
// load rounds
for(QString roundId : roundList.keys()) {
if(roundId.toInt() > categoryMap["route_order"].toInt())
continue;
BRRound::BRRoundData roundData;
roundData.name = roundList[roundId].toString();
BRRound* round = this->getRound(competitionData->competition->getFederation(), roundId.toInt(), roundData);
categoryData.rounds.append(round);
// if this was the previous round -> restore it!
if(round->getId() == rawData["route_order"].toInt())
categoryData.currentRound = round;
}
}
else {
// we are loading result data!
// TODO: clean up!!
if(competitionData->competition->getCurrentCategory()->getId() != rawData["GrpId"].toInt())
// if the current category does not match the loaded category, there is some error and we cannot proceed!
return;
// load the category!
// set default round if it was not restored
if(categoryData.currentRound == nullptr && categoryData.rounds.length() > 0)
categoryData.currentRound = categoryData.rounds[0];
BRCategory* category = this->getCategory(federation, categoryMap["GrpId"].toInt(), categoryData);
competitionData->categories.append(category);
// restore current category and load its reults
if(category->getId() == rawData["GrpId"]) {
competitionData->currentCategory = category;
if(categoryData.currentRound != nullptr) {
BRRound::BRRoundData roundData = categoryData.currentRound->getData();
// load results
QVariantList resultList = rawData["participants"].toList();
for(QVariant resultVar : resultList) {
QVariantMap resultMap = resultVar.toMap();
// load athlete
BRAthlete::BRAthleteData athleteData;
// TODO: start number
athleteData.firstName = resultMap["firstname"].toString();
athleteData.lastName = resultMap["lastname"].toString();
athleteData.federation = resultMap["federation"].toString();
athleteData.federationUrl = resultMap["fed_url"].toUrl();
athleteData.nation = resultMap["nation"].toString();
athleteData.city = resultMap["city"].toString();
athleteData.yearOfBirth = resultMap["birthyear"].toInt();
qDebug() << "--- Adding athlete: " << athleteData.firstName << " " << athleteData.lastName;
BRAthlete* athlete = this->getAthlete(BRWidget::IFSC, resultMap["athlete_id"].toInt(), athleteData);
// load result
QString resultNumber = categoryData.currentRound->getId() < 0 ? "":QString::number(categoryData.currentRound->getId());
qDebug() << "Adding result: rank: " << resultMap["result_rank"];
BRResult::BRResultData resultData;
resultData.rank = resultMap["result_rank"].toInt();
resultData.athlete = athlete;
BRResult* result = this->getResult(categoryData.category->getFederation(), -1, resultData);
roundData.results.append(result);
}
this->setRoundData(categoryData.currentRound, roundData);
}
}
// load round results
}
}
@ -306,40 +399,19 @@ BRCup::BRCupData BRProviderDr::parseCupData(QVariantList categoriesList, QVarian
return data;
}
BRWidget::BRWidgetStatusCode BRProviderDr::getWidgetData(BRCategory::BRCategoryData* categoryData) {
// load category data
QString competitionId = QString::number(categoryData->category->getCompetition()->getId());
QString categoryId = QString::number(categoryData->category->getId());
QString requestUrl = "https://www.digitalrock.de/egroupware/ranking/json.php?comp=" + competitionId + "&cat=" + categoryId;
QVariantMap ret = this->serverRequest(QUrl(requestUrl));
if(ret["status"] != 200){
// request was a failure
return BRWidget::BRWidgetStatusCode(ret["status"].toInt());
}
QVariantMap data = QJsonDocument::fromJson(ret["text"].toString().toUtf8()).toVariant().toMap();
this->parseCategoryData(categoryData, data);
return BRWidget::Success;
}
BRCategory::BRCategoryData BRProviderDr::parseCategoryData(QVariantMap rawData) {
BRCategory::BRCategoryData data;
// TODO: status
// TODO: sex
// TODO: load routes
// TODO: athletes
this->parseCategoryData(&data, rawData);
return data;
}
void BRProviderDr::parseCategoryData(BRCategory::BRCategoryData* categoryData, QVariantMap rawData) {
// TODO: status
// TODO: sex
// TODO: load routes
// TODO: athletes
//categoryData->name = rawData["name"].toString();
}
// category is already set-up -> only load rounds!
BRWidget::BRWidgetStatusCode BRProviderDr::getWidgetData(BRRound::BRRoundData* roundData) {
}

View file

@ -129,12 +129,46 @@ void BRProviderVl::parseLeagueData(BRLeague::BRLeagueData* data, QVariantMap raw
BRWidget::BRWidgetStatusCode BRProviderVl::getWidgetData(BRCompetition::BRCompetitionData* competitionData) {
qDebug() << "LOADING COMP 4";
if(competitionData->competition->getCurrentCategory() == nullptr)
return BRWidget::NotImplementedError;
return BRWidget::OpeationNotSupportedError;
qDebug() << "LOADING COMP 5";
return competitionData->competition->getCurrentCategory()->load();
BRCategory* currentCategory = competitionData->competition->getCurrentCategory();
if(currentCategory->getCurrentRound() == nullptr)
return BRWidget::OpeationNotSupportedError;
BRRound* currentRound = currentCategory->getCurrentRound();
BRRound::BRRoundData roundData = currentRound->getData();
qDebug() << "LOADING ROUND DATA";
// load round data
QString competitionId = QString::number(roundData.round->getCategory()->getCompetition()->getId());
QString categoryId = QString::number(roundData.round->getCategory()->getId());
QString roundId = QString::number(roundData.round->getId());
QString requestUrl;
if(roundId == "-1") {
requestUrl = "https://ifsc.results.info/api/v1/events/" + competitionId + "/result/" + categoryId;
}
else {
requestUrl = "https://ifsc.results.info/api/v1/category_rounds/" + roundId + "/results";
}
QVariantMap ret = this->serverRequest(QUrl(requestUrl), {{"x-auth-token", "cc7375f680648e7e6171e035e70351eb"}});
if(ret["status"] != 200){
// request was a failure
return BRWidget::BRWidgetStatusCode(ret["status"].toInt());
}
QVariantMap data = QJsonDocument::fromJson(ret["text"].toString().toUtf8()).toVariant().toMap();
this->parseRoundData(&roundData, data);
this->setRoundData(currentRound, roundData);
return BRWidget::Success;
}
BRCompetition::BRCompetitionData BRProviderVl::parseCompetitionData(QVariantMap rawData, BRWidget::BRFederation federation) {
@ -170,7 +204,8 @@ BRCompetition::BRCompetitionData BRProviderVl::parseCompetitionData(QVariantMap
data.categories.append(category);
}
// TODO load results
data.currentCategory = nullptr;
return data;
}
@ -196,9 +231,6 @@ BRCup::BRCupData BRProviderVl::parseCupData(QVariantMap rawData) {
}
BRWidget::BRWidgetStatusCode BRProviderVl::getWidgetData(BRCategory::BRCategoryData* categoryData) {
return categoryData->category->getCurrentRound()->load();
}
BRCategory::BRCategoryData BRProviderVl::parseCategoryData(QVariantMap rawData) {
// TODO: status
@ -267,36 +299,6 @@ void BRProviderVl::parseCategoryData(BRCategory::BRCategoryData* categoryData, Q
BRWidget::BRWidgetStatusCode BRProviderVl::getWidgetData(BRRound::BRRoundData* roundData) {
// load round data
QString competitionId = QString::number(roundData->round->getCategory()->getCompetition()->getId());
QString categoryId = QString::number(roundData->round->getCategory()->getId());
QString roundId = QString::number(roundData->round->getId());
QString requestUrl;
if(roundId == "-1") {
requestUrl = "https://ifsc.results.info/api/v1/events/" + competitionId + "/result/" + categoryId;
}
else {
requestUrl = "https://ifsc.results.info/api/v1/category_rounds/" + roundId + "/results";
}
QVariantMap ret = this->serverRequest(QUrl(requestUrl), {{"x-auth-token", "cc7375f680648e7e6171e035e70351eb"}});
if(ret["status"] != 200){
// request was a failure
return BRWidget::BRWidgetStatusCode(ret["status"].toInt());
}
QVariantMap data = QJsonDocument::fromJson(ret["text"].toString().toUtf8()).toVariant().toMap();
this->parseRoundData(roundData, data);
return BRWidget::Success;
}
BRRound::BRRoundData BRProviderVl::parseRoundData(QVariantMap rawData) {
BRRound::BRRoundData data;
this->parseRoundData(&data, rawData);

View file

@ -18,21 +18,18 @@ QList<QObject*> BRRound::getResultsQML() {
return this->listToQmlList(this->results);
}
BRWidget::BRWidgetStatusCode BRRound::load() {
BRRoundData newData {
BRRound::BRRoundData BRRound::getData() {
BRRound::BRRoundData data {
this,
this->name,
this->name,
this->results
};
BRWidget::BRWidgetStatusCode statusCode = this->getProvider()->getWidgetData(&newData);
return data;
}
if(statusCode != BRWidget::Success)
return statusCode;
this->setData(newData);
return BRWidget::Success;
BRWidget::BRWidgetStatusCode BRRound::load() {
return BRWidget::OpeationNotSupportedError;
}
void BRRound::setData(BRRoundData data) {