Skip to content
Snippets Groups Projects
Commit e7d0bc00 authored by PavelBegunkov's avatar PavelBegunkov
Browse files

sql GetStudentsForDiscipline: --param semesterID

parent a77e1365
Branches
Tags
No related merge requests found
......@@ -1286,9 +1286,9 @@ CREATE FUNCTION `Discipline_Delegate` (
) RETURNS int(11)
NO SQL
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION RETURN -1;
DECLARE vTemp INT DEFAULT 0;
DECLARE EXIT HANDLER FOR SQLEXCEPTION RETURN -1;
SET vTemp = Discipline_BindTeacher(pDisciplineID, pNewAuthorID);
UPDATE `disciplines`
......
......@@ -495,11 +495,13 @@ END //
# all students in general groups, that take course (with attached and detached)
DROP PROCEDURE IF EXISTS GetStudentsForDiscipline//
CREATE PROCEDURE `GetStudentsForDiscipline` (
IN `pDisciplineID` INT,
IN `pSemesterID` INT
IN `pDisciplineID` INT
)
NO SQL
BEGIN
DECLARE vSemesterID INT DEFAULT -1;
SET vSemesterID = GetDisciplineSemesterID(pDisciplineID);
SELECT view_disciplines_students.StudentID AS 'ID',
view_disciplines_students.LastName,
view_disciplines_students.FirstName,
......@@ -512,7 +514,7 @@ BEGIN
view_disciplines_students.AttachType AS 'AttachType'
FROM `view_disciplines_students`
WHERE view_disciplines_students.DisciplineID = pDisciplineID AND
view_disciplines_students.SemesterID = pSemesterID
view_disciplines_students.SemesterID = vSemesterID
ORDER BY (view_disciplines_students.AttachType IS NULL OR
view_disciplines_students.AttachType = 'detach') DESC,
view_disciplines_students.GradeID ASC,
......
......@@ -2,9 +2,8 @@
class Model_Students extends Model
{
public static function ofDiscipline($id, $semesterID = null) {
$semesterID = $semesterID ? $semesterID : User::instance()->SemesterID;;
$sql = "CALL `GetStudentsForDiscipline`('$id', $semesterID); ";
public static function ofDiscipline($id) {
$sql = "CALL `GetStudentsForDiscipline`('$id'); ";
return DB::query(Database::SELECT, $sql)->execute();
}
......
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