mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
в процессе2
This commit is contained in:
@@ -435,6 +435,54 @@ int DataBaseLMS::updateStatusTaskFIM(int task_id, QString status)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(status == "new")
|
||||
{//Удаляем отчет
|
||||
queryStr = QString("SELECT reports.report_id "
|
||||
"FROM public.reports "
|
||||
"WHERE fk_task_fim_id = %1 "
|
||||
"ORDER BY reports.report_id ASC").arg(
|
||||
QString::number(task_id));
|
||||
|
||||
int report_id = 0;
|
||||
|
||||
QSqlQuery queryReportsSEL = QSqlQuery(*db);
|
||||
if(queryExec(queryStr, &queryReportsSEL))
|
||||
{
|
||||
if (queryReportsSEL.first())
|
||||
{//Отчет
|
||||
report_id = queryReportsSEL.value(0).toInt();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resBool = db->rollback();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
queryStr = QString("DELETE FROM public.report_items "
|
||||
"WHERE fk_report_id = %1 ").arg(
|
||||
QString::number(report_id));
|
||||
|
||||
QSqlQuery queryItemsDEL = QSqlQuery(*db);
|
||||
if(!queryExec(queryStr, &queryItemsDEL))
|
||||
{
|
||||
resBool = db->rollback();
|
||||
return 0;
|
||||
}
|
||||
|
||||
queryStr = QString("DELETE FROM public.reports "
|
||||
"WHERE report_id = %1 ").arg(
|
||||
QString::number(report_id));
|
||||
|
||||
QSqlQuery queryReportsDEL = QSqlQuery(*db);
|
||||
if(!queryExec(queryStr, &queryReportsDEL))
|
||||
{
|
||||
resBool = db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
resBool = db->commit();
|
||||
return id_trainee;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user