diff --git a/db/postgresql/issue551_global_form_leave.sql b/db/postgresql/issue551_global_form_leave.sql new file mode 100644 index 0000000000000000000000000000000000000000..30b49c8b7a6b7bba3e29f03902f676168e276018 --- /dev/null +++ b/db/postgresql/issue551_global_form_leave.sql @@ -0,0 +1,56 @@ +DROP FUNCTION IF EXISTS public.getratesforstudentsbystage(pdisciplineid integer, pmilestone integer); +CREATE OR REPLACE FUNCTION public.getratesforstudentsbystage(pdisciplineid integer, pmilestone integer) + RETURNS TABLE("StudentID" integer, "Semester" integer, "Bonus" integer, "Extra" integer, "PreviousExtra" integer, "Exam" integer, "PreviousExam" integer, "Option" absence_pass, "AutoPassed" integer, "LastName" character varying, "FirstName" character varying, "SecondName" character varying) + LANGUAGE plpgsql +AS $function$ + +DECLARE vSemesterID INT DEFAULT -1; + vInGeneralGroup BOOL DEFAULT FALSE; +BEGIN + vSemesterID := GetDisciplineProperty(pDisciplineID, 'semester'); + + DROP TABLE IF EXISTS tStudents; + CREATE TEMPORARY TABLE tStudents AS ( + SELECT record_books.ID, record_books.StudentID + FROM record_books + LEFT JOIN disciplines_students on disciplines_students.DisciplineID = pDisciplineid and + disciplines_students.RecordBookID = record_books.ID + JOIN students_groups on record_books.id = students_groups.recordbookid + left join view_disciplines_recordbooks on disciplines_students.recordbookid = view_disciplines_recordbooks.recordbookid + WHERE students_groups.SemesterID = vSemesterID AND + students_groups.State <= 'outlet' AND + COALESCE(disciplines_students.Type, 'attach') = 'attach' and + view_disciplines_recordbooks.disciplineid = pDisciplineid + ); + + return query + SELECT tRes.*, + accounts.LastName as "LastName", + accounts.FirstName as "FirstName", + accounts.SecondName as "SecondName" + FROM ( + SELECT tStudents.StudentID as "StudentID", + cast (SUM(tRate.Rate*iif_sql(tMap.ModuleType = 'regular',1,0)) as integer) AS "Semester", + cast (SUM(tRate.Rate*iif_sql(tMap.ModuleType = 'bonus',1,0)) as integer) AS "Bonus", + cast (SUM(tRate.Rate*iif_sql(tMap.ModuleType = 'extra',1,0)*iif_sql(tMap.SubmoduleOrderNum < pMilestone,1,0)) as integer) AS "Extra", + cast (SUM(tRate.Rate*iif_sql(tMap.ModuleType = 'extra',1,0)*iif_sql(tMap.SubmoduleOrderNum < pMilestone - 1,1,0)) as integer) AS "PreviousExtra", + cast (SUM(tRate.Rate*iif_sql(tMap.ModuleType = 'exam',1,0)*iif_sql(tMap.SubmoduleOrderNum = pMilestone,1,0)) as integer) AS "Exam", + MAX(tRate.Rate*iif_sql(tMap.ModuleType = 'exam',1,0)*iif_sql(tMap.SubmoduleOrderNum < pMilestone,1,0)) AS "PreviousExam", + MAX(CASE WHEN tMap.SubmoduleOrderNum = pMilestone THEN exam_period_options."type" ELSE NULL END) As "Option", + MAX(CASE WHEN exam_period_options."type" = 'pass' THEN 1 ELSE 0 END) As "AutoPassed" + FROM tStudents + LEFT JOIN view_roadmap AS tMap ON tMap.DisciplineID = pDisciplineID + LEFT JOIN rating_table AS tRate ON tRate.RecordbookID = tStudents.ID AND + tRate.SubmoduleID = tMap.SubmoduleID + LEFT JOIN exam_period_options ON exam_period_options.submoduleID = tMap.SubmoduleID AND + exam_period_options.RecordbookID = tStudents.ID + GROUP BY tStudents.StudentID + ) tRes + INNER JOIN students ON students.ID = tRes."StudentID" + INNER JOIN accounts ON students.AccountID = accounts.ID + ORDER BY accounts.LastName ASC, + accounts.FirstName ASC, + accounts.SecondName ASC; +END +$function$; + diff --git a/scripts/clone_db.bat b/scripts/clone_db.bat new file mode 100644 index 0000000000000000000000000000000000000000..3ed203ab3044f7037d43d25b372b64b51c317914 --- /dev/null +++ b/scripts/clone_db.bat @@ -0,0 +1,4 @@ +psql -h localhost -U postgres -d postgres -a -f reload_db.sql +pg_dump --format=custom -h localhost -p 5535 -U grade --no-password -d grade -f C:\work\Grade\postresql\grade-dump\dump-grade-latest.backup +pg_restore -h localhost -U postgres -d testgrade C:\work\Grade\postresql\grade-dump\dump-grade-latest.backup +psql -h localhost -U postgres -d testgrade -a -f post_reload.sql \ No newline at end of file diff --git a/scripts/post_reload.sql b/scripts/post_reload.sql new file mode 100644 index 0000000000000000000000000000000000000000..eaf3c05a48eb45a15069a621410ab159b309c667 --- /dev/null +++ b/scripts/post_reload.sql @@ -0,0 +1 @@ +update accounts set password=sha1('11111'); \ No newline at end of file diff --git a/scripts/reload_db.sql b/scripts/reload_db.sql new file mode 100644 index 0000000000000000000000000000000000000000..972825f4e53bcf531a951446a881b52990d5493b --- /dev/null +++ b/scripts/reload_db.sql @@ -0,0 +1,5 @@ +drop database testgrade; +create database testgrade; +\c testgrade +create extension pgcrypto +\q \ No newline at end of file diff --git a/~dev_rating/application/classes/Controller/Handler/FileCreator.php b/~dev_rating/application/classes/Controller/Handler/FileCreator.php index ea01306dbc62925a99a38fa4666f5096374c4c77..0f8ae7c35f1f47cdb146308344b9edbfb61e7e09 100644 --- a/~dev_rating/application/classes/Controller/Handler/FileCreator.php +++ b/~dev_rating/application/classes/Controller/Handler/FileCreator.php @@ -850,6 +850,9 @@ class Controller_Handler_FileCreator extends Controller_Handler case 'отл': $res[1] = 'зачтено (5)'; break; + case 'н/д': + $res[1] = "не зачтено"; + break; } return $res; } diff --git a/~dev_rating/application/classes/Controller/Handler/Sign.php b/~dev_rating/application/classes/Controller/Handler/Sign.php index 7a27c06851df7b2524521dabbc738d31f3a53fbe..9af5fd91a421c152ff9848f5b4ce41a87900ef20 100644 --- a/~dev_rating/application/classes/Controller/Handler/Sign.php +++ b/~dev_rating/application/classes/Controller/Handler/Sign.php @@ -174,11 +174,11 @@ class Controller_Handler_Sign extends Controller_Handler } } elseif ($isStudent) { $globalKey = 'st-' . str_pad(str_replace('st-', '', $globalKey), 9, '0', STR_PAD_LEFT); - $id = User::instance()->signInByOpenID($globalKey); + $id = User::instance()->signStudentInByOpenID($globalKey); if ($id === 0) { if ($studentId) { $key = 'st-'.str_pad($studentId, 9, '0', STR_PAD_LEFT); - $id = User::instance()->signInByOpenID($key); + $id = User::instance()->signStudentInByOpenID($key); if ($id === 0) { $error = "не найден аккаунт студента!"; } diff --git a/~dev_rating/application/views/popup/support.twig b/~dev_rating/application/views/popup/support.twig index 82f4fd95d02dba182f049d67f42532e161b5829b..b617c05c226a7baf7746e7a85e23c39bad39a51f 100644 --- a/~dev_rating/application/views/popup/support.twig +++ b/~dev_rating/application/views/popup/support.twig @@ -2,7 +2,7 @@ Служба поддержки||600px||10%|| <div id="errDialog"> <div class="dialogTopText"> - <p>Обратите внимание на <b><a href="http://grade.sfedu.ru/faq" >ЧаВо</a></b> (часто задаваемые вопросы).</p> + <p>Обратите внимание на <b><a href="https://grade.sfedu.ru/faq" >ЧаВо</a></b> (часто задаваемые вопросы).</p> <hr> <p> С помощью данной формы можно отправить разработчикам предложение по улучшению работы сервиса или сообщение об ошибке.