- implemented api compatibility level 0.02.1
- fixed 8th value of event not being shown in teacher mode
This commit is contained in:
parent
68f07778c0
commit
4e8ac13332
4 changed files with 16 additions and 7 deletions
|
@ -59,7 +59,7 @@ private:
|
||||||
|
|
||||||
ReturnData_t senddata(QUrl serviceUrl, QUrlQuery postData);
|
ReturnData_t senddata(QUrl serviceUrl, QUrlQuery postData);
|
||||||
|
|
||||||
QList<int> apiVersion = {0,1,15};
|
QList<int> apiVersion = {0,2,1};
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ Page {
|
||||||
height: mainMenu.buttonHeight
|
height: mainMenu.buttonHeight
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
eventConfirmationDialog.openDay( _cppAppSettings.loadSetting("teacherMode") === "true" ? "lheute":"sheute")
|
eventConfirmationDialog.openDay( 0 )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ Page {
|
||||||
height: mainMenu.buttonHeight
|
height: mainMenu.buttonHeight
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
eventConfirmationDialog.openDay( _cppAppSettings.loadSetting("teacherMode") === "true" ? "lmorgen":"smorgen")
|
eventConfirmationDialog.openDay( 1 )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,10 @@ EventModel::EventModel(QObject *parent) : QAbstractListModel(parent)
|
||||||
// convert the stringlist from the serverconn to a Day-list
|
// convert the stringlist from the serverconn to a Day-list
|
||||||
foreach(QList<QString>day, pGlobalServConn->m_events){
|
foreach(QList<QString>day, pGlobalServConn->m_events){
|
||||||
m_events.append({day[0], day[1], day[2], day[3], day[4], day[5], day[6]});
|
m_events.append({day[0], day[1], day[2], day[3], day[4], day[5], day[6]});
|
||||||
|
if(day.length() > 7){
|
||||||
|
// in teachermode it can happen that an event has eight value in that case the 8th value is appended to the 7th one
|
||||||
|
m_events[m_events.length()-1].text = m_events[m_events.length()-1].text + " | " + day[7];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,7 @@ int ServerConn::checkConn()
|
||||||
|
|
||||||
int ServerConn::getEvents(QString day)
|
int ServerConn::getEvents(QString day)
|
||||||
{
|
{
|
||||||
|
// day: 0-today; 1-tomorrow
|
||||||
if(this->state != "loggedIn"){
|
if(this->state != "loggedIn"){
|
||||||
return(401);
|
return(401);
|
||||||
}
|
}
|
||||||
|
@ -149,6 +150,7 @@ int ServerConn::getEvents(QString day)
|
||||||
QUrlQuery pdata;
|
QUrlQuery pdata;
|
||||||
pdata.addQueryItem("username", this->username);
|
pdata.addQueryItem("username", this->username);
|
||||||
pdata.addQueryItem("password", this->password);
|
pdata.addQueryItem("password", this->password);
|
||||||
|
pdata.addQueryItem("mode", pGlobalAppSettings->loadSetting("teacherMode") == "true" ? "1":"0");
|
||||||
pdata.addQueryItem("day", day);
|
pdata.addQueryItem("day", day);
|
||||||
|
|
||||||
// send the request
|
// send the request
|
||||||
|
@ -179,11 +181,12 @@ int ServerConn::getEvents(QString day)
|
||||||
|
|
||||||
//qDebug() << jsonString;
|
//qDebug() << jsonString;
|
||||||
QJsonDocument jsonFilters = QJsonDocument::fromJson(ret.text.toUtf8());
|
QJsonDocument jsonFilters = QJsonDocument::fromJson(ret.text.toUtf8());
|
||||||
// array with all filters in it
|
|
||||||
QJsonObject dataArray = jsonFilters.object();
|
// array with tghe whole response in it
|
||||||
|
QJsonObject JsonArray = jsonFilters.object();
|
||||||
|
|
||||||
// get the version of the json format
|
// get the version of the json format
|
||||||
QString version = dataArray.value("version").toString();
|
QString version = JsonArray.value("version").toString();
|
||||||
QStringList versionList = version.split(".");
|
QStringList versionList = version.split(".");
|
||||||
if(versionList.length() < 3){
|
if(versionList.length() < 3){
|
||||||
return(900);
|
return(900);
|
||||||
|
@ -197,6 +200,8 @@ int ServerConn::getEvents(QString day)
|
||||||
return(904);
|
return(904);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get parse the document out of the return
|
||||||
|
QJsonObject dataArray = JsonArray.value("data").toObject();
|
||||||
|
|
||||||
// get the header data
|
// get the header data
|
||||||
tmpEventHeader.append(dataArray.value("targetDate").toString());
|
tmpEventHeader.append(dataArray.value("targetDate").toString());
|
||||||
|
@ -515,7 +520,7 @@ QString ServerConn::getState() {
|
||||||
void ServerConn::setState(QString state) {
|
void ServerConn::setState(QString state) {
|
||||||
|
|
||||||
if(state != this->state){
|
if(state != this->state){
|
||||||
qDebug() << "+----- serverconn has new state: " + state + " -----+";
|
qDebug() << "+----- serverconn has new state: " << state << " -----+";
|
||||||
this->state = state;
|
this->state = state;
|
||||||
this->stateChanged(this->state);
|
this->stateChanged(this->state);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue