Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
grade
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anton Yushko
grade
Commits
c418910a
Commit
c418910a
authored
10 years ago
by
PavelBegunkov
Browse files
Options
Downloads
Patches
Plain Diff
db ref pt. 6: redundant semester id parameters
parent
3a2ef1d9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
db/StoredProcedures.sql
+71
-54
71 additions, 54 deletions
db/StoredProcedures.sql
~dev_rating/application/classes/Model/Rating.php
+4
-6
4 additions, 6 deletions
~dev_rating/application/classes/Model/Rating.php
with
75 additions
and
60 deletions
db/StoredProcedures.sql
+
71
−
54
View file @
c418910a
...
...
@@ -226,7 +226,7 @@ END //
#
Label
:
accounts
#
-------------------------------------------------------------------------------------------
#
TODO
:
deprecated
#
TODO
:
deprecated
(
see
GetFullInfo
)
DROP
PROCEDURE
IF
EXISTS
GetAccountInfo
//
CREATE
PROCEDURE
`GetAccountInfo`
(
IN
`pUserID`
INT
)
NO
SQL
...
...
@@ -246,7 +246,7 @@ BEGIN
LIMIT
1
;
END
//
#
TODO
:
deprecated
#
TODO
:
deprecated
(
see
GetFullInfo
)
DROP
PROCEDURE
IF
EXISTS
GetPersonalInfo
//
CREATE
PROCEDURE
`GetPersonalInfo`
(
IN
`pUserID`
INT
,
...
...
@@ -464,7 +464,10 @@ CREATE PROCEDURE `SearchTeachers` (
) NO SQL
BEGIN
DECLARE vAuthorID INT DEFAULT -1;
DECLARE vFullNameReg VARCHAR(102) CHARSET utf8;
SET vAuthorID = GetDisciplineProperty(pDisciplineID, '
author
');
SET vFullNameReg = CONCAT('
%
', pFullName, '
%
');
CREATE TEMPORARY TABLE IF NOT EXISTS tDiscTeachers AS (
SELECT disciplines_teachers.TeacherID
...
...
@@ -482,14 +485,19 @@ BEGIN
( view_teachers.TeacherID = vAuthorID ) AS '
IsAuthor
'
FROM `view_teachers`
WHERE view_teachers.FacultyID = pFacultyID AND
(
pDepartmentID = 0
OR
view_teachers.DepID = pDepartmentID
)
AND
CASE WHEN
pDepartmentID
!
= 0
THEN
view_teachers.DepID = pDepartmentID
ELSE TRUE END
AND
NOT EXISTS (
SELECT * FROM tDiscTeachers
WHERE tDiscTeachers.TeacherID = view_teachers.TeacherID
LIMIT 1
) AND
CASE
WHEN pFullName !=
''
THEN
CONCAT( view_teachers.LastName, '
', view_teachers.FirstName, '
', view_teachers.SecondName)
LIKE CONCAT('
%
', pFullName, '
%
')
LIKE vFullNameReg
ELSE
TRUE
END
ORDER BY view_teachers.FacultyID ASC,
view_teachers.DepName ASC,
view_teachers.LastName ASC,
...
...
@@ -553,7 +561,7 @@ BEGIN
END //
#
students, that don'
t
included
in
general
groups
withou
t
attached
#
not
in general groups
, no
t attached
DROP PROCEDURE IF EXISTS SearchStudents//
CREATE PROCEDURE `SearchStudents` (
IN `pGradeID` INT,
...
...
@@ -623,7 +631,7 @@ END //
#
all
students
in
general
groups
,
that
take
course
(
with
attached
and
detached
)
# in general groups, attached and detached
DROP PROCEDURE IF EXISTS GetStudentsForDiscipline//
CREATE PROCEDURE `GetStudentsForDiscipline` (
IN `pDisciplineID` INT
...
...
@@ -656,14 +664,15 @@ END //
#
all
students
takes
that
course
(
general
groups
+
attached
)
#
in
general groups + attached
DROP PROCEDURE IF EXISTS GetStudentsForRating//
CREATE PROCEDURE `GetStudentsForRating` (
IN
`pDisciplineID`
INT
,
IN
`pSemesterID`
INT
)
NO
SQL
IN `pDisciplineID` INT
) NO SQL
BEGIN
DECLARE vSemesterID INT DEFAULT -1;
SET vSemesterID = GetDisciplineProperty(pDisciplineID, '
semester
');
SELECT view_disciplines_students.StudentID AS '
ID
',
view_disciplines_students.LastName,
view_disciplines_students.FirstName,
...
...
@@ -675,7 +684,7 @@ BEGIN
view_disciplines_students.GroupNum,
(view_disciplines_students.AttachType IS NOT NULL) AS '
IsAttached
'
FROM `view_disciplines_students`
WHERE
view_disciplines_students
.
SemesterID
=
p
SemesterID
AND
WHERE view_disciplines_students.SemesterID =
v
SemesterID AND
view_disciplines_students.DisciplineID = pDisciplineID AND
(view_disciplines_students.AttachType IS NULL OR
view_disciplines_students.AttachType = '
attach
')
...
...
@@ -695,10 +704,18 @@ END //
DROP PROCEDURE IF EXISTS GetDisciplineInfo//
CREATE
PROCEDURE
`GetDisciplineInfo`
(
IN
`pDisciplineID`
INT
)
NO
SQL
CREATE PROCEDURE `GetDisciplineInfo`
(
IN `pDisciplineID` INT
)
NO SQL
BEGIN
DECLARE vIsBonus BOOLEAN;
SET vIsBonus = EXISTS(
SELECT * FROM `modules`
WHERE modules.DisciplineID = pDisciplineID AND
modules.Type = '
bonus
'
LIMIT 1
);
SELECT
view_disciplines.DisciplineID AS '
ID
',
view_disciplines.AuthorID AS '
authorID
',
...
...
@@ -718,10 +735,8 @@ NO SQL
view_disciplines.IsLocked AS '
isLocked
',
view_disciplines.Milestone AS '
milestone
',
view_disciplines.Subtype AS '
subtype
',
(
modules
.
ID
IS
NOT
NULL
)
AS
'isBonus'
vIsBonus
AS '
isBonus
'
FROM `view_disciplines`
LEFT
JOIN
`modules`
ON
modules
.
DisciplineID
=
view_disciplines
.
DisciplineID
AND
modules
.
Type
=
'bonus'
WHERE view_disciplines.DisciplineID = pDisciplineID
LIMIT 1;
END //
...
...
@@ -733,8 +748,7 @@ DROP PROCEDURE IF EXISTS GetDisciplines//
CREATE
PROCEDURE
`GetDisciplines`
(
IN
`pFacultyID`
INT
,
IN
`pSemesterID`
INT
)
NO SQL
)
NO
SQL
BEGIN
SELECT
view_disciplines
.
DisciplineID
AS
'ID'
,
view_disciplines
.
SubjectID
AS
'subjectID'
,
...
...
@@ -868,6 +882,7 @@ CREATE PROCEDURE `GetRatesForGroup` (
BEGIN
DECLARE
vChecker
BOOLEAN
DEFAULT
FALSE
;
DECLARE
vSemesterID
INT
DEFAULT
-
1
;
SET
vSemesterID
=
GetDisciplineProperty
(
pDisciplineID
,
'semester'
);
SELECT
disciplines_groups
.
ID
IS
NOT
NULL
INTO
vChecker
FROM
`disciplines_groups`
...
...
@@ -875,7 +890,7 @@ BEGIN
disciplines_groups
.
GroupID
=
pGroupID
LIMIT
1
;
SET vSemesterID = GetDisciplineProperty(pDisciplineID, '
semester
');
IF
!
vChecker
THEN
SELECT
students
.
ID
,
...
...
@@ -1022,11 +1037,13 @@ END //
DROP
PROCEDURE
IF
EXISTS
GetAttestationData
//
CREATE
PROCEDURE
`GetAttestationData`
(
IN
`pDisciplineID`
INT
,
IN `pGroupID` INT,
IN `pSemesterID` INT
IN
`pGroupID`
INT
)
NO
SQL
BEGIN
DECLARE
vSemesterID
INT
DEFAULT
-
1
;
SET
vSemesterID
=
GetDisciplineProperty
(
pDisciplineID
,
'semester'
);
SELECT
students
.
ID
AS
'StudentID'
,
rating_table
.
Rate
As
'Rate'
,
rating_table
.
Date
As
'Date'
,
...
...
@@ -1034,7 +1051,7 @@ BEGIN
modules
.
Type
As
'Type'
FROM
`students`
INNER
JOIN
`students_groups`
ON
students_groups
.
StudentID
=
students
.
ID
AND
students_groups.SemesterID =
p
SemesterID
students_groups
.
SemesterID
=
v
SemesterID
LEFT
JOIN
`disciplines_groups`
ON
disciplines_groups
.
DisciplineID
=
pDisciplineID
AND
disciplines_groups
.
GroupID
=
students_groups
.
GroupID
...
...
This diff is collapsed.
Click to expand it.
~dev_rating/application/classes/Model/Rating.php
+
4
−
6
View file @
c418910a
...
...
@@ -2,9 +2,8 @@
class
Model_Rating
extends
Model
{
public
static
function
GetStudentsForRating
(
$disciplineID
,
$semesterID
=
null
)
{
$semesterID
=
$semesterID
?
$semesterID
:
User
::
instance
()
->
SemesterID
;
$sql
=
"CALL `GetStudentsForRating`('
$disciplineID
',
$semesterID
); "
;
public
static
function
GetStudentsForRating
(
$disciplineID
)
{
$sql
=
"CALL `GetStudentsForRating`('
$disciplineID
'); "
;
return
DB
::
query
(
Database
::
SELECT
,
$sql
)
->
execute
();
}
...
...
@@ -49,9 +48,8 @@ class Model_Rating extends Model
return
DB
::
query
(
Database
::
SELECT
,
$sql
)
->
execute
();
}
public
static
function
getAttestationData
(
$disciplineID
,
$groupID
,
$semesterID
=
null
)
{
$semesterID
=
$semesterID
?
$semesterID
:
User
::
instance
()
->
SemesterID
;
$sql
=
"CALL `GetAttestationData`(
$disciplineID
,
$groupID
,
$semesterID
)"
;
public
static
function
getAttestationData
(
$disciplineID
,
$groupID
)
{
$sql
=
"CALL `GetAttestationData`(
$disciplineID
,
$groupID
)"
;
return
DB
::
query
(
Database
::
SELECT
,
$sql
)
->
execute
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment