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:
@@ -810,6 +810,67 @@ QList<TaskAmmFim> DataBaseLMS::selectTasksFIMofTrainee(int id_trainee)
|
||||
return QList<TaskAmmFim>();
|
||||
}
|
||||
|
||||
|
||||
//Выгребаем отчет для этой задачи
|
||||
int report_id = 0;
|
||||
queryStr = QString("SELECT reports.report_id "
|
||||
"FROM public.reports "
|
||||
"WHERE report_task = %1 "
|
||||
"ORDER BY reports.report_id ASC").arg(
|
||||
QString::number(task.getID()));
|
||||
|
||||
QSqlQuery queryReport = QSqlQuery(*db);
|
||||
|
||||
if(queryExec(queryStr, &queryReport))
|
||||
{
|
||||
if (queryReport.first())
|
||||
{//Отчет
|
||||
report_id = queryReport.value(0).toInt();
|
||||
task.report.id = report_id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resBool = db->rollback();
|
||||
return QList<TaskAmmFim>();
|
||||
}
|
||||
|
||||
if(report_id)
|
||||
{//Отчет есть
|
||||
//Выгребаем все item отчета
|
||||
|
||||
queryStr = QString("SELECT report_items.item_id, report_items.text, report_items.doc, report_items.dm_code, report_items.title, report_items.result, report_items.item_report, report_items.number "
|
||||
"FROM public.report_items "
|
||||
"WHERE item_report = %1 "
|
||||
"ORDER BY report_items.number ASC").arg(
|
||||
QString::number(report_id));
|
||||
|
||||
QSqlQuery queryItems = QSqlQuery(*db);
|
||||
|
||||
if(queryExec(queryStr, &queryItems))
|
||||
{
|
||||
while (queryItems.next())
|
||||
{//report_item
|
||||
FIMReportItem reportItem;
|
||||
reportItem.id = queryItems.value(0).toInt();
|
||||
reportItem.text = queryItems.value(1).toString();
|
||||
reportItem.procedure.doc = queryItems.value(2).toString();
|
||||
reportItem.procedure.dmCode = queryItems.value(3).toString();
|
||||
reportItem.procedure.title = queryItems.value(4).toString();
|
||||
reportItem.procedure.result = queryItems.value(5).toString();
|
||||
//item_report
|
||||
//number
|
||||
|
||||
task.report.itemList.append(reportItem);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resBool = db->rollback();
|
||||
return QList<TaskAmmFim>();
|
||||
}
|
||||
}
|
||||
|
||||
listTasks.append(task);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
FIMReportItem(){};
|
||||
~FIMReportItem(){};
|
||||
public:
|
||||
int id = 0; // для идентификации в БД
|
||||
QString text; // текст, вводимый обучаемым
|
||||
ProcedureID procedure; // ссылка на процедуру, при необходимости
|
||||
};
|
||||
@@ -61,6 +62,7 @@ public:
|
||||
FIMReport(){};
|
||||
~FIMReport(){};
|
||||
public:
|
||||
int id = 0; // для идентификации в БД
|
||||
QList<FIMReportItem> itemList;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user