after interface 13.11.2024

This commit is contained in:
krivoshein
2024-11-13 17:16:33 +03:00
parent 61aaac2b1c
commit 2ed1eac956
80 changed files with 1734 additions and 1379 deletions

View File

@@ -487,6 +487,56 @@ Trainee DataBaseLMS::selectTrainee(int id_trainee)
return trainee;
}
QList<Trainee> DataBaseLMS::selectAllTraineesInGroup(int id_group)
{
QList<Trainee> listTrainees;
QString queryStr = QString("SELECT trainees.trainee_id, trainees.name, trainees.login, trainees.password, trainees.archived, trainees.logged_in, "
"groups.group_id, groups.name, "
"computers.computer_id, computers.name, computers.ip_address, "
"classrooms.classroom_id, classrooms.name "
"FROM public.trainees JOIN public.groups ON groups.group_id = trainees.group_trainee "
"LEFT OUTER JOIN public.computers ON computers.computer_id = trainees.computer_trainee "
"LEFT OUTER JOIN public.classrooms ON classrooms.classroom_id = computers.classroom_computer "
"WHERE trainees.group_trainee = %1 "
"ORDER BY groups.name, trainees.name ASC").arg(
id_group);
QSqlQuery query = QSqlQuery(*db);
if(!query.exec(queryStr))
{
messageWarningErrorQuery(queryStr, &query);
}
else
{
while (query.next())
{//Обучаемый
Trainee trainee;
trainee.setID(query.value(0).toInt());
trainee.setName(query.value(1).toString());
trainee.setLogin(query.value(2).toString());
trainee.setPassword(query.value(3).toString());
trainee.setArchived(query.value(4).toBool());
trainee.setLoggedIn(query.value(5).toBool());
Group group = Group(query.value(6).toInt(), query.value(7).toString());
trainee.setGroup(group);
Classroom classroom = Classroom(query.value(11).toInt(), query.value(12).toString());
Computer computer = Computer(query.value(8).toInt(), query.value(9).toString(), query.value(10).toString(), classroom);
trainee.setComputer(computer);
trainee.setTasks(selectTasksOfTrainee(trainee.getID()));
listTrainees.append(trainee);
}
}
return listTrainees;
}
int DataBaseLMS::selectTraineeID(QString login, QString password)
{
QString queryStr;