diff --git a/db/DatabaseSample.sql b/db/DatabaseSample.sql index 671ba8b7081d3000acf41e7aca228de42d5f380c..51c34a6639cbf7082b6ef6b71f01fe1c99989332 100644 --- a/db/DatabaseSample.sql +++ b/db/DatabaseSample.sql @@ -3,7 +3,7 @@ -- http://www.phpmyadmin.net -- -- РҐРѕСЃС‚: 127.0.0.1:3306 --- Время создания: РСЋР» 29 2014 Рі., 13:54 +-- Время создания: РђРІРі 04 2014 Рі., 18:58 -- Версия сервера: 5.5.37-log -- Версия PHP: 5.3.28 @@ -205,6 +205,9 @@ CREATE TABLE IF NOT EXISTS `disciplines` ( `AuthorID` int(11) NOT NULL, `ExamType` enum('exam','credit') NOT NULL, `SemesterID` int(11) NOT NULL, + `PracticeCount` int(11) NOT NULL DEFAULT '0', + `LectionCount` int(11) NOT NULL DEFAULT '0', + `Type` enum('general','special','choosen') NOT NULL DEFAULT 'general', PRIMARY KEY (`ID`), KEY `SubjectID` (`SubjectID`), KEY `TeacherID` (`AuthorID`), @@ -215,11 +218,11 @@ CREATE TABLE IF NOT EXISTS `disciplines` ( -- Дамп данных таблицы `disciplines` -- -INSERT INTO `disciplines` (`ID`, `Name`, `Grade`, `SubjectID`, `AuthorID`, `ExamType`, `SemesterID`) VALUES -(1, 'Матан1', 1, 1, 3, 'exam', 2), -(2, 'Диф-СЂС‹ 1', 1, 2, 3, 'credit', 2), -(3, 'РћСЃРё 1', 2, 3, 5, 'exam', 2), -(4, 'Топология 1', 1, 4, 3, 'exam', 2); +INSERT INTO `disciplines` (`ID`, `Name`, `Grade`, `SubjectID`, `AuthorID`, `ExamType`, `SemesterID`, `PracticeCount`, `LectionCount`, `Type`) VALUES +(1, 'Матан1', 1, 1, 3, 'exam', 2, 0, 0, 'general'), +(2, 'Диф-СЂС‹ 1', 1, 2, 3, 'credit', 2, 0, 0, 'general'), +(3, 'РћСЃРё 1', 2, 3, 5, 'exam', 2, 0, 0, 'general'), +(4, 'Топология 1', 1, 4, 3, 'exam', 2, 0, 0, 'general'); -- -------------------------------------------------------- @@ -402,8 +405,9 @@ INSERT INTO `rating_table` (`ID`, `StudentID`, `TeacherID`, `SubmoduleID`, `Rate CREATE TABLE IF NOT EXISTS `requests` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `AccountID` int(11) DEFAULT NULL, - `Text` text NOT NULL, + `Information` text NOT NULL, `Date` date NOT NULL, + `Status` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`ID`), KEY `AccountID` (`AccountID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; diff --git a/db/DatabaseStructure.sql b/db/DatabaseStructure.sql index a29d0211737ac568d4b5b3df301f028da7aea1fb..14b68b49b78c26178bdbd59f40b6bf297d876757 100644 --- a/db/DatabaseStructure.sql +++ b/db/DatabaseStructure.sql @@ -3,7 +3,7 @@ -- http://www.phpmyadmin.net -- -- РҐРѕСЃС‚: 127.0.0.1:3306 --- Время создания: РСЋР» 29 2014 Рі., 13:55 +-- Время создания: РђРІРі 04 2014 Рі., 18:59 -- Версия сервера: 5.5.37-log -- Версия PHP: 5.3.28 @@ -138,6 +138,9 @@ CREATE TABLE IF NOT EXISTS `disciplines` ( `AuthorID` int(11) NOT NULL, `ExamType` enum('exam','credit') NOT NULL, `SemesterID` int(11) NOT NULL, + `PracticeCount` int(11) NOT NULL DEFAULT '0', + `LectionCount` int(11) NOT NULL DEFAULT '0', + `Type` enum('general','special','choosen') NOT NULL DEFAULT 'general', PRIMARY KEY (`ID`), KEY `SubjectID` (`SubjectID`), KEY `TeacherID` (`AuthorID`), @@ -261,8 +264,9 @@ CREATE TABLE IF NOT EXISTS `rating_table` ( CREATE TABLE IF NOT EXISTS `requests` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `AccountID` int(11) DEFAULT NULL, - `Text` text NOT NULL, + `Information` text NOT NULL, `Date` date NOT NULL, + `Status` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`ID`), KEY `AccountID` (`AccountID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/db/StoredProcedures.sql b/db/StoredProcedures.sql index 7ca39e604c0f57c122e9d0e49d573ccea645a3f4..09eb731b4303f360d27e75c0b963cceb083297cc 100644 --- a/db/StoredProcedures.sql +++ b/db/StoredProcedures.sql @@ -661,7 +661,7 @@ END // DROP FUNCTION IF EXISTS InternalOccurrenceChecker ; // CREATE FUNCTION `InternalOccurrenceChecker` ( `StudentID` INT, `AG_ID` INT ) - RETURNS boolean + RETURNS int(11) NO SQL BEGIN @@ -679,7 +679,7 @@ BEGIN ) LIMIT 1; - RETURN (mID>0); + RETURN mID; END // @@ -706,12 +706,15 @@ BEGIN students.FirstName, students.SecondName, study_groups.Grade, - study_groups.Group + study_groups.Group, + (attending_groups_pool.StudentID IS NOT NULL) AS 'isAttached' + FROM `disciplines_teachers` INNER JOIN `disciplines` ON disciplines.ID = disciplines_teachers.DisciplineID CROSS JOIN `lessons` ON lessons.DisciplineTeacherID = disciplines_teachers.ID INNER JOIN `attending_groups` ON attending_groups.ID = lessons.AttendingGroupID - CROSS JOIN `students` ON InternalOccurrenceChecker(students.ID, attending_groups.ID) = TRUE + CROSS JOIN `students` ON InternalOccurrenceChecker(students.ID, attending_groups.ID) > 0 + LEFT JOIN `attending_groups_pool` ON attending_groups_pool.AttendingGroupID = attending_groups.ID AND attending_groups_pool.StudentID = students.ID INNER JOIN `study_groups` ON students.StudyGroupID = study_groups.ID WHERE disciplines_teachers.TeacherID = TeacherID AND disciplines_teachers.DisciplineID = DisciplineID