Статусы задач обновляются автоматически в ГУИ

This commit is contained in:
2025-05-12 17:20:18 +03:00
parent 96260e1641
commit c34317cbc8
6 changed files with 59 additions and 22 deletions

View File

@@ -65,7 +65,6 @@ void ProcessParser::read(ClientHandler *client, QByteArray array)
}
else if(xmlReader.name() == "ListTasksAMM")
{
//TODO
if(client->getClient()->getIsUnity())
{//Отчет по задаче АММ от Юнити-клиента
clientUnityTaskAMMreport(xmlReader,client, array);
@@ -73,7 +72,6 @@ void ProcessParser::read(ClientHandler *client, QByteArray array)
}
else if(xmlReader.name() == "ListTasksFIM")
{
//TODO
if(client->getClient()->getIsUnity())
{//Отчет по задаче FIM от Юнити-клиента
clientUnityTaskFIMreport(xmlReader,client, array);
@@ -140,6 +138,8 @@ void ProcessParser::clientUnityTaskAMMreport(QXmlStreamReader &xmlReader, Client
processingSystem->processingClientQueryToDB(client, queryToDB, trainee_id, data);
}
}
emit processingSystem->sigStatusTasksAMMofTraineeChanged(trainee_id);
}
void ProcessParser::clientUnityTaskFIMreport(QXmlStreamReader &xmlReader, ClientHandler *client, QByteArray array)
@@ -186,6 +186,8 @@ void ProcessParser::clientUnityTaskFIMreport(QXmlStreamReader &xmlReader, Client
processingSystem->processingClientQueryToDB(client, queryToDB, trainee_id, data);
}
}
emit processingSystem->sigStatusTasksFIMofTraineeChanged(trainee_id);
}
TaskAmmFim ProcessParser::xmlParserQueryToDB_ASSIGN_TASK_FIM_TO_TRAINEE(QByteArray array)

View File

@@ -17,6 +17,9 @@ public:
signals:
void sigLogMessage(QString text);
//void sigStatusTasksAMMofTraineeChanged(int trainee_id);
//void sigStatusTasksFIMofTraineeChanged(int trainee_id);
private:
ProcessingSystem *processingSystem;
void clientAuth(QXmlStreamReader &xmlReader,ClientHandler *client);

View File

@@ -55,6 +55,50 @@ void CommonClientHandler::slot_ListsInstructorsTraineesChanged()
}
}
void CommonClientHandler::slot_StatusTasksAMMofTraineeChanged(int trainee_id)
{
//Проходим все открытые сокеты
foreach(int idSocket, clientsMap->keys())
{
ClientHandler *handler = clientsMap->value(idSocket);
//Проверяем, есть ли клиенты TYPE_GUI
if(handler->getClient()->getTypeClient() == TypeClientAutorization::TYPE_GUI)
{//Отправляем этому клиенту задачи AMM для Обучаемого (с измененным статусом)
ClientQueryToDB queryToDB;
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_TASKS_AMM_FOR_TRAINEE;
processingSystem->processingClientQueryToDB(handler, queryToDB, trainee_id);
}
}
//Отправка списка задач AMM клиенту Юнити
if(ClientHandler* clientUnity = processingSystem->getUnityClientById(trainee_id))
{//Есть такой
//processingSystem->sendListTasksAMMofTraineetoClient(clientUnity, trainee_id);
}
}
void CommonClientHandler::slot_StatusTasksFIMofTraineeChanged(int trainee_id)
{
//Проходим все открытые сокеты
foreach(int idSocket, clientsMap->keys())
{
ClientHandler *handler = clientsMap->value(idSocket);
//Проверяем, есть ли клиенты TYPE_GUI
if(handler->getClient()->getTypeClient() == TypeClientAutorization::TYPE_GUI)
{//Отправляем этому клиенту задачи FIM для Обучаемого (с измененным статусом)
ClientQueryToDB queryToDB;
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_TASKS_FIM_FOR_TRAINEE;
processingSystem->processingClientQueryToDB(handler, queryToDB, trainee_id);
}
}
//Отправка списка задач FIM клиенту Юнити
if(ClientHandler* clientUnity = processingSystem->getUnityClientById(trainee_id))
{//Есть такой
//processingSystem->sendListTasksFIMofTraineetoClient(clientUnity, trainee_id);
}
}
void CommonClientHandler::slot_sendPacketToAllClients(PacketType packetType)
{
foreach(int idSocket, clientsMap->keys())

View File

@@ -21,6 +21,8 @@ public:
void sendNewVersionListToAllClient();
void sendCurrentVersionToAllClient();
void slot_ListsInstructorsTraineesChanged();
void slot_StatusTasksAMMofTraineeChanged(int trainee_id);
void slot_StatusTasksFIMofTraineeChanged(int trainee_id);
void slot_sendPacketToAllClients(PacketType packetType);
//слот обработки сигнала о готовности нового сообщения на отправку клиенту от мессенджера
void slot_msgToClientFromGUI(QString login, QString text);

View File

@@ -23,6 +23,10 @@ void ProcessingSystem::initialize(ServerLMSWidget *server,
this->updateController = updateController;
connect(this,&ProcessingSystem::sigListsInstructorsTraineesChanged,commonClientHandler, &CommonClientHandler::slot_ListsInstructorsTraineesChanged,Qt::AutoConnection);
connect(this,&ProcessingSystem::sigStatusTasksAMMofTraineeChanged,commonClientHandler, &CommonClientHandler::slot_StatusTasksAMMofTraineeChanged,Qt::AutoConnection);
connect(this,&ProcessingSystem::sigStatusTasksFIMofTraineeChanged,commonClientHandler, &CommonClientHandler::slot_StatusTasksFIMofTraineeChanged,Qt::AutoConnection);
connect(this,&ProcessingSystem::sigUpdateListClients,server, &ServerLMSWidget::slotUpdateListClients,Qt::AutoConnection);
connect(this,&ProcessingSystem::sigSetData,updateController,&UpdateController::setDataInfo,Qt::AutoConnection);
connect(this,&ProcessingSystem::signal_msgToClientReady,commonClientHandler, &CommonClientHandler::slot_msgToClientFromGUI);
@@ -333,17 +337,7 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu
{
if(int id_trainee = providerDBLMS->editTaskAMM(*(TaskAmmFim*)data))
{
//Отправка списка задач AMM клиенту GUI
//sendListTasksAMMofTraineetoClient(client, id_trainee);
//Извещаем об изменениях в авторизации
//emit sigListTasksAMMofTraineetoClientChanged();
//TODO
//Отправка списка задач AMM клиенту Юнити
if(ClientHandler* clientUnity = getUnityClientById(id_trainee))
{//Есть такой
sendListTasksAMMofTraineetoClient(clientUnity, id_trainee);
}
}
break;
}
@@ -351,17 +345,7 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu
{
if(int id_trainee = providerDBLMS->editTaskFIM(*(TaskAmmFim*)data))
{
//Отправка списка задач FIM клиенту GUI
//sendListTasksFIMofTraineetoClient(client, id_trainee);
//Извещаем об изменениях в авторизации
//emit sigListTasksFIMofTraineetoClientChanged();
//TODO
//Отправка списка задач FIM клиенту Юнити
if(ClientHandler* clientUnity = getUnityClientById(id_trainee))
{//Есть такой
sendListTasksFIMofTraineetoClient(clientUnity, id_trainee);
}
}
break;
}

View File

@@ -46,6 +46,8 @@ public:
signals:
void sigUpdateListClients();
void sigListsInstructorsTraineesChanged();
void sigStatusTasksAMMofTraineeChanged(int trainee_id);
void sigStatusTasksFIMofTraineeChanged(int trainee_id);
void sigLogMessage(QString log);
void sigAddToMessanger(QString login,QString text);
void signal_msgToClientReady(QString login, QString text);