This commit is contained in:
Dorian Zedler 2021-03-07 20:39:07 +01:00
parent 85c8760bed
commit 64670b9d88
Signed by: dorian
GPG key ID: 989DE36109AFA354
2 changed files with 75 additions and 87 deletions

View file

@ -124,7 +124,7 @@ Page {
delegate: Button {
id: catBt
width: parent.width
width: selectorLv.width
height: text !== "" ? selectorLv.delegateHeight:0
flat: true

View file

@ -68,7 +68,7 @@ BRWidget::BRWidgetStatusCode BRProviderDr::getWidgetData(BRCalendar::BRCalendarD
QString requestUrl = "https://www.digitalrock.de/egroupware/ranking/json.php?nation=" + nationStr + "&year=" + QString::number(year);
QVariantMap ret = this->serverRequest(QUrl(requestUrl));
if(ret["status"] != 200){
if(ret["status"] != 200) {
// request was a failure
return BRWidget::BRWidgetStatusCode(ret["status"].toInt());
}
@ -97,11 +97,7 @@ BRWidget::BRWidgetStatusCode BRProviderDr::getWidgetData(BRCalendar::BRCalendarD
return BRWidget::Success;
}
BRWidget::BRWidgetStatusCode BRProviderDr::getWidgetData(BRSeason::BRSeasonData* seasonData) {
if(seasonData->season->getLeagues().length() > 0) {
// leagues are already loaded
// load some data
QString nationStr = seasonData->season->getFederation() == BRWidget::SAC ? "SUI":"GER";
@ -110,7 +106,7 @@ BRWidget::BRWidgetStatusCode BRProviderDr::getWidgetData(BRSeason::BRSeasonData*
QString requestUrl = "https://www.digitalrock.de/egroupware/ranking/json.php?nation=" + nationStr + "&year=" + QString::number(year);
QVariantMap ret = this->serverRequest(QUrl(requestUrl));
if(ret["status"] != 200){
if(ret["status"] != 200) {
// request was a failure
return BRWidget::BRWidgetStatusCode(ret["status"].toInt());
}
@ -125,11 +121,6 @@ BRWidget::BRWidgetStatusCode BRProviderDr::getWidgetData(BRSeason::BRSeasonData*
this->parseSeasonData(seasonData, year, data);
return BRWidget::Success;
}
else {
// should never happen
return BRWidget::NotImplementedError;
}
}
BRSeason::BRSeasonData BRProviderDr::parseSeasonData(int id, QVariantMap rawData) {
@ -202,7 +193,6 @@ BRLeague::BRLeagueData BRProviderDr::parseLeagueData(QVariantMap leaguePropertie
return data;
}
BRWidget::BRWidgetStatusCode BRProviderDr::getWidgetData(BRCompetition::BRCompetitionData* competitionData) {
if(competitionData->competition->getCurrentCategory() == nullptr)
@ -227,7 +217,7 @@ BRWidget::BRWidgetStatusCode BRProviderDr::getWidgetData(BRCompetition::BRCompet
ret = this->serverRequest(QUrl(requestUrl));
// handle route not found errors
if(ret["status"] != 200 && (ret["status"] != 404 || retryCount > 1)){
if(ret["status"] != 200 && (ret["status"] != 404 || retryCount > 1)) {
// request was a failure
return BRWidget::BRWidgetStatusCode(ret["status"].toInt());
}
@ -410,8 +400,6 @@ void BRProviderDr::parseCompetitionData(BRCompetition::BRCompetitionData* compet
}
}
BRCup::BRCupData BRProviderDr::parseCupData(QVariantList categoriesList, QVariantMap rawData, BRWidget::BRFederation federation) {
BRCup::BRCupData data;