diff --git a/DOCS/Алексей/Board.md b/DOCS/Алексей/Board.md index f254041..07a16e9 100644 --- a/DOCS/Алексей/Board.md +++ b/DOCS/Алексей/Board.md @@ -19,6 +19,7 @@ kanban-plugin: board ## feature client Unity - [ ] Добавить обновление инструктора, если он перелогинился +- [ ] FIM проверять на null задачу ## feature client QT @@ -43,6 +44,8 @@ kanban-plugin: board ## Complete +- [ ] FIM разграничить кнопку и статус задачи +- [ ] АММ - убрать возможность отмены - [ ] сохранение не отправленных задач - [ ] Unity: неправильно обновляется статус задачи - [ ] окошко с выбором перенести в GUI diff --git a/ServerLMS/Systems/processingsystem.cpp b/ServerLMS/Systems/processingsystem.cpp index d22db51..33c7883 100644 --- a/ServerLMS/Systems/processingsystem.cpp +++ b/ServerLMS/Systems/processingsystem.cpp @@ -90,23 +90,6 @@ void ProcessingSystem::processingClientAutorization(ClientHandler *client, Clien client->sendXmlAnswer(arrayAnswer); client->sendVersion(); - //Отправка списков задач клиенту Юнити - if(client->getClient()->getIsUnity()) - { - QString login = client->getClient()->getLogin(); - int id_trainee = providerDBLMS->getIdTraineeByLogin(login); - - //AMM - QList listTasksAMM = providerDBLMS->GetListTasksAMMofTrainee(id_trainee); - QByteArray arrayAnswerTasksAMM = dataParser->DbAnswer()->listTasksAMMofTrainee(true, &listTasksAMM, id_trainee); - client->sendXmlAnswer(arrayAnswerTasksAMM, PacketType::TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_TRAINEE); - - //FIM - QList listTasksFIM = providerDBLMS->GetListTasksFIMofTrainee(id_trainee); - QByteArray arrayAnswerFIM = dataParser->DbAnswer()->listTasksFIMofTrainee(true, &listTasksFIM, id_trainee); - client->sendXmlAnswer(arrayAnswerFIM, PacketType::TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE); - } - QString str = QString(arrayAnswer); //logger->addTextToLogger("To Client: " + str); @@ -423,17 +406,9 @@ void ProcessingSystem::processingClientNotify(ClientHandler *client, ClientNotif { if(clientNotify.Code == commandReadyClient) {//Клиент готов принять задания - client->getClient()->setReady(true); //скорее всего функции будут внутри хэндлера - - //Отправляем пакет с заданиями для Обучаемого(клиента) - + client->setReady(true); + sendTaskListToUnity(client); client->getSocket()->flush(); - - //QStringList listTasks; - //QByteArray arrayAnswer = dataParser->ClientAnswer()->tasks(listTasks); - //client->sendXmlAnswer(arrayAnswer); - //QString str = QString(arrayAnswer); - //emit sigLogMessage("To Client: " + str); } else if(clientNotify.Code == commandDisableClient) { @@ -459,6 +434,9 @@ void ProcessingSystem::processingClientNotify(ClientHandler *client, ClientNotif client->sigSendNotify(commandUnchangable); } + }else if(clientNotify.Code == commandGetTasks) + { + sendTaskListToUnity(client); } } @@ -481,6 +459,26 @@ void ProcessingSystem::sendListTasksFIMofTraineetoClient(ClientHandler *client, client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE); } +void ProcessingSystem::sendTaskListToUnity(ClientHandler *client) +{ + //Отправка списков задач клиенту Юнити + if(client->getClient()->getIsUnity()) + { + QString login = client->getClient()->getLogin(); + int id_trainee = providerDBLMS->getIdTraineeByLogin(login); + + //AMM + QList listTasksAMM = providerDBLMS->GetListTasksAMMofTrainee(id_trainee); + QByteArray arrayAnswerTasksAMM = dataParser->DbAnswer()->listTasksAMMofTrainee(true, &listTasksAMM, id_trainee); + client->sendXmlAnswer(arrayAnswerTasksAMM, PacketType::TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_TRAINEE); + + //FIM + QList listTasksFIM = providerDBLMS->GetListTasksFIMofTrainee(id_trainee); + QByteArray arrayAnswerFIM = dataParser->DbAnswer()->listTasksFIMofTrainee(true, &listTasksFIM, id_trainee); + client->sendXmlAnswer(arrayAnswerFIM, PacketType::TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE); + } +} + ClientHandler *ProcessingSystem::getUnityClientById(int id) { QString login = providerDBLMS->getLoginTraineeById(id); diff --git a/ServerLMS/Systems/processingsystem.h b/ServerLMS/Systems/processingsystem.h index d59620c..a09ecdd 100644 --- a/ServerLMS/Systems/processingsystem.h +++ b/ServerLMS/Systems/processingsystem.h @@ -60,6 +60,7 @@ private: DataParser *dataParser; UpdateController *updateController; ProviderDBLMS* providerDBLMS; + void sendTaskListToUnity(ClientHandler *client); }; #endif // PROCESSINGSYSTEM_H diff --git a/ServerLMS/Systems/sendsystem.cpp b/ServerLMS/Systems/sendsystem.cpp index 45335a7..52f257f 100644 --- a/ServerLMS/Systems/sendsystem.cpp +++ b/ServerLMS/Systems/sendsystem.cpp @@ -201,8 +201,7 @@ void SendSystem::sendXmlAnswer(QByteArray array, PacketType packetType) socket->waitForBytesWritten(); } - - socket->waitForReadyRead(1000); + socket->waitForReadyRead(2000); } void SendSystem::sendNeedUpdate(bool flag,quint64 size,quint64 fileCount,quint64 deleteCount) diff --git a/ServerLMS/Systems/tools.h b/ServerLMS/Systems/tools.h index cd8840f..09cf2ad 100644 --- a/ServerLMS/Systems/tools.h +++ b/ServerLMS/Systems/tools.h @@ -44,6 +44,7 @@ static const QString commandCanChangeVersion = "CANCHANGE"; static const QString commandChangable = "CHANGEABLE"; static const QString commandUnchangable = "UNCHANGEABLE"; static const QString commandUpdateFilesClient = "update"; +static const QString commandGetTasks = "GETTASKS"; class Tools { public: diff --git a/ServerLMS/clienthandler.cpp b/ServerLMS/clienthandler.cpp index 5b0604f..0274c7f 100644 --- a/ServerLMS/clienthandler.cpp +++ b/ServerLMS/clienthandler.cpp @@ -83,6 +83,11 @@ void ClientHandler::sendVersion() emit sigSendVersion(); } +void ClientHandler::setReady(bool flag) +{ + getClient()->setReady(flag); +} + void ClientHandler::sendVersionList() { QFile file(versionListFile); diff --git a/ServerLMS/clienthandler.h b/ServerLMS/clienthandler.h index 7f840db..ebde3d0 100644 --- a/ServerLMS/clienthandler.h +++ b/ServerLMS/clienthandler.h @@ -39,6 +39,7 @@ public: void sendVersionList(); void sendPacketType(PacketType packetType); void sendVersion(); + void setReady(bool flag); ~ClientHandler();