mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Статус задачи обновляется в ГУИ
This commit is contained in:
@@ -690,13 +690,48 @@ int DataBaseLMS::updateTaskFIM(TaskAmmFim task)
|
||||
|
||||
int DataBaseLMS::updateStatusTaskFIM(int task_id, QString status)
|
||||
{
|
||||
QString queryStr = QString("UPDATE public.tasks_fim SET status = '%1' "
|
||||
QString queryStr;
|
||||
bool resBool = false;
|
||||
int id_trainee = 0;
|
||||
|
||||
resBool = db->transaction();
|
||||
|
||||
queryStr = QString("SELECT trainees.trainee_id "
|
||||
"FROM public.trainees JOIN public.tasks_fim ON trainees.trainee_id = tasks_fim.trainee_task "
|
||||
"WHERE tasks_fim.task_id = %1 "
|
||||
"ORDER BY trainees.trainee_id ASC").arg(
|
||||
QString::number(task_id));
|
||||
|
||||
QSqlQuery query = QSqlQuery(*db);
|
||||
|
||||
if(queryExec(queryStr, &query))
|
||||
{
|
||||
if (query.first())
|
||||
{//Обучаемый
|
||||
id_trainee = query.value(0).toInt();
|
||||
}
|
||||
}
|
||||
if(!id_trainee)
|
||||
{
|
||||
resBool = db->rollback();
|
||||
return 0;
|
||||
}
|
||||
|
||||
queryStr = QString("UPDATE public.tasks_fim SET status = '%1' "
|
||||
"WHERE task_id = %2 "
|
||||
"RETURNING tasks_fim.task_id").arg(
|
||||
status,
|
||||
QString::number(task_id) );
|
||||
|
||||
return queryExecInt(queryStr);
|
||||
QSqlQuery query1 = QSqlQuery(*db);
|
||||
if(!queryExec(queryStr, &query1))
|
||||
{
|
||||
resBool = db->rollback();
|
||||
return 0;
|
||||
}
|
||||
|
||||
resBool = db->commit();
|
||||
return id_trainee;
|
||||
}
|
||||
|
||||
int DataBaseLMS::deleteTaskFIM(int id_task)
|
||||
|
||||
Reference in New Issue
Block a user