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

CHG: hide group titles in tables for global disciplines #474

parent c0129a61
Branches
No related merge requests found
-- ищет межфакультетские дисциплины по семестру, ведущему факультету, предмету и типу
-- межфакультетскими считает все дисциплины, которые не связаны с учебными планами
DROP FUNCTION IF EXISTS public.discipline_find_global(psemesterid integer, psubjectid integer, pexamtype exam_credit_grading_credit, pfacultyid integer);
CREATE OR REPLACE FUNCTION public.discipline_find_global(psemesterid integer, psubjectid integer, pexamtype exam_credit_grading_credit, pfacultyid integer)
RETURNS SETOF integer
LANGUAGE sql
......@@ -19,7 +20,7 @@ WHERE disciplines.SemesterID = pSemesterID AND
LIMIT 1;
$function$;
DROP FUNCTION IF EXISTS public.internalbindstudent(pdisciplineid integer, precordbookid integer);
CREATE OR REPLACE FUNCTION public.internalbindstudent(pdisciplineid integer, precordbookid integer)
RETURNS integer
LANGUAGE plpgsql
......@@ -35,6 +36,7 @@ BEGIN
END
$function$;
DROP FUNCTION IF EXISTS public.internalunbindstudent(pdisciplineid integer, precordbookid integer);
CREATE OR REPLACE FUNCTION public.internalunbindstudent(pdisciplineid integer, precordbookid integer)
RETURNS integer
LANGUAGE plpgsql
......@@ -48,4 +50,53 @@ BEGIN
EXCEPTION
when others then RETURN -1;
END
$function$;
\ No newline at end of file
$function$;
DROP FUNCTION IF EXISTS public.discipline_getinfo(pdisciplineid integer);
CREATE OR REPLACE FUNCTION public.discipline_getinfo(pdisciplineid integer)
RETURNS TABLE("ID" integer, "AuthorID" integer, "GradeID" integer, "GradeNum" integer, "Degree" bachelor_master_specialist, "Type" exam_credit_grading_credit, "Lectures" integer, "Practice" integer, "Labs" integer, "SemesterID" integer, "SubjectID" integer, "SubjectName" character varying, "SubjectAbbr" character varying, "FacultyID" integer, "FacultyName" character varying, "IsLocked" integer, "Milestone" integer, "Subtype" scientific_disciplinary_coursework, "CompoundDiscID" integer, "IsMapCreated" boolean, "IsGlobal" boolean, "IsBonus" boolean, "semesterNum" integer, "semesterYear" integer)
LANGUAGE plpgsql
AS $function$
DECLARE vIsBonus BOOLEAN;
begin
-- select * from public.discipline_getinfo(
-- :pdisciplineid -- put the pdisciplineid parameter value instead of 'pdisciplineid' (int4)
--);
vIsBonus := EXISTS(
SELECT * FROM modules
WHERE modules.DisciplineID = pDisciplineID AND
modules.Type = 'bonus'
LIMIT 1
);
return query
SELECT
view_disciplines.DisciplineID AS "ID",
view_disciplines.AuthorID as "AuthorID",
view_disciplines.GradeID as "GradeID",
view_disciplines.GradeNum as "GradeNum",
view_disciplines."degree" as "Degree",
view_disciplines.ExamType AS "Type",
view_disciplines.LectureCount AS "Lectures",
view_disciplines.PracticeCount AS "Practice",
view_disciplines.LabCount AS "Labs",
view_disciplines.SemesterID as "SemesterID",
view_disciplines.SubjectID as "SubjectID",
view_disciplines.SubjectName as "SubjectName",
view_disciplines.SubjectAbbr as "SubjectAbbr",
view_disciplines.FacultyID as "FacultyID",
view_disciplines.FacultyName as "FacultyName",
view_disciplines.IsLocked as "IsLocked",
view_disciplines.Milestone as "Milestone",
view_disciplines.Subtype as "Subtype",
view_disciplines.CompoundDiscID as "CompoundDiscID",
(view_disciplines.MaxRate = 100) AS "IsMapCreated",
NOT EXISTS (SELECT disciplines_study_plans.id from disciplines_study_plans WHERE disciplines_study_plans.DisciplineID = view_disciplines.DisciplineID) AS "IsGlobal",
vIsBonus AS "IsBonus",
semesters.Num AS "semesterNum", -- TODO: Camelize
semesters.Year AS "semesterYear"
FROM view_disciplines
INNER JOIN semesters ON semesters.ID = view_disciplines.SemesterID
WHERE view_disciplines.DisciplineID = pDisciplineID
LIMIT 1;
END ;
$function$;
......@@ -73,7 +73,7 @@
{{ HTML.component('office/dropzone/dz.twig')|raw }}
</div>
<div class="b-upload-second-step" style="display:none">
<div class="b-upload-second-step" 1>
{% if Faculties is not empty %}
<p>Выберите факультет, на который нужно загрузить преподавателей:</p>
......
......@@ -200,7 +200,11 @@
<button class="defaultForm GreenButton" id="group_{{ GroupID }}">Скачать ведомость</button>
</div>
{% if Discipline.IsGlobal %}
<span class="groupTitle" style="display:none">
{% else %}
<span class="groupTitle">
{% endif %}
{% if Group.Degree == 'master' %}
Магистратура, {{ Group.GradeNum }} год
{% elseif Group.Degree == 'specialist' %}
......
......@@ -154,8 +154,14 @@
{% for GroupID, StudentsList in Students %}
{% set Group = Groups[GroupID] %}
<tr id="group_{{ GroupID }}" class="group_{{ GroupID }}">
<td class="group" colspan="{{ ColCount }}">
<tr id="group_{{ GroupID }}" class="group_{{ GroupID }}">
{% if Discipline.IsGlobal %}
<td class="group" colspan="{{ ColCount }}" style="display:none">
{% else %}
<td class="group" colspan="{{ ColCount }}">
{% endif %}
{% if Group.Degree == 'master' %}
Магистратура, {{ Group.GradeNum }} год
{% elseif Group.Degree == 'specialist' %}
......
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