Skip to content
Snippets Groups Projects
Commit bd84bc42 authored by Anton Bagliy's avatar Anton Bagliy
Browse files

ADD: filter students with leave in discipline student list #340

parent 9dd1dd61
Branches
No related merge requests found
......@@ -359,3 +359,37 @@ BEGIN
end;
$function$;
CREATE OR REPLACE FUNCTION public.discipline_getstudents(pdisciplineid integer)
RETURNS TABLE("ID" integer, "RecordBookID" integer, "LastName" character varying, "FirstName" character varying, "SecondName" character varying, "GradeID" integer, "GradeNum" integer, "Degree" bachelor_master_specialist, "GroupID" integer, "GroupNum" integer, "AttachType" attach_detach)
LANGUAGE plpgsql
AS $function$
DECLARE vSemesterID int DEFAULT -1;
BEGIN
--select * from grade.Discipline_GetStudents(
-- :pDisciplineID -- put the pDisciplineID parameter value instead of 'pDisciplineID' (INT)
--);
vSemesterID = GetDisciplineProperty(pDisciplineID, 'semester');
return query
SELECT view_students.StudentID AS "ID",
view_students.RecordBookID as "RecordBookID",
view_students.LastName as "LastName",
view_students.FirstName as "FirstName",
view_students.SecondName as "SecondName",
view_students.GradeID as "GradeID",
view_students.GradeNum as "GradeNum",
view_students."degree" as "Degree",
view_students.GroupID as "GroupID",
view_students.GroupNum as "GroupNum",
view_disciplines_recordbooks."type" AS "AttachType"
FROM view_disciplines_recordbooks
INNER JOIN view_students ON view_disciplines_recordbooks.RecordBookID = view_students.RecordBookID
WHERE view_students.SemesterID = vSemesterID AND view_disciplines_recordbooks.DisciplineID = pDisciplineID
and view_students.recordbookid in (select recordbookid from students_groups where state <= 'outlet' and semesterid=vsemesterid)
ORDER BY view_disciplines_recordbooks."type" = 'attach' ASC,
view_students.GradeID ASC,
view_students.GroupNum ASC,
view_students.LastName ASC,
view_students.FirstName ASC;
END
$function$
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment