Skip to content
Snippets Groups Projects
Commit eded31ae authored by dmitry.s's avatar dmitry.s Committed by xamgore
Browse files

Добавлена страница истории оценок в дисцпилине

* Модифицировал роут, добавил новый тип history
* Новая хранимая процедура SQL для получения списка логов
* На данный момент выводится сырые данные, нужен интерфейс
parent 9a25614a
Branches
No related merge requests found
...@@ -1187,6 +1187,30 @@ BEGIN ...@@ -1187,6 +1187,30 @@ BEGIN
view_roadmap.SubmoduleOrderNum ASC; view_roadmap.SubmoduleOrderNum ASC;
END // END //
DROP PROCEDURE IF EXISTS mmcs_rating.GetRatesHistory//
CREATE PROCEDURE `GetRatesHistory` (
IN `pDisciplineID` INT
) NO SQL
BEGIN
SELECT logs_rating.ID,
logs_rating.Date,
logs_rating.Rate,
students.LastName AS 'StudentLast',
students.FirstName AS 'StudentFirst',
students.SecondName AS 'StudentSecond',
teachers.LastName AS 'TeacherLast',
teachers.FirstName AS 'TeacherFirst',
teachers.SecondName AS 'TeacherSecond',
submodules.Name AS 'SubmoduleName',
modules.Name AS 'ModuleName'
FROM `logs_rating`
INNER JOIN `students` ON students.ID = logs_rating.StudentID
INNER JOIN `teachers` ON teachers.ID = logs_rating.TeacherID
INNER JOIN `submodules` ON submodules.ID = logs_rating.SubmoduleID
INNER JOIN `modules` ON modules.ID = submodules.ModuleID
WHERE modules.DisciplineID = pDisciplineID;
END //
DROP PROCEDURE IF EXISTS GetAttestationData// DROP PROCEDURE IF EXISTS GetAttestationData//
CREATE PROCEDURE `GetAttestationData` ( CREATE PROCEDURE `GetAttestationData` (
IN `pDisciplineID` INT, IN `pDisciplineID` INT,
...@@ -1396,4 +1420,4 @@ BEGIN ...@@ -1396,4 +1420,4 @@ BEGIN
LIMIT 1; LIMIT 1;
END // END //
DELIMITER ; DELIMITER ;
\ No newline at end of file
...@@ -259,12 +259,12 @@ Route::set('discipline:edit', 'discipline/<id>((/)<section>)', ['id' => '\d+']) ...@@ -259,12 +259,12 @@ Route::set('discipline:edit', 'discipline/<id>((/)<section>)', ['id' => '\d+'])
]); ]);
# discipline rate table # discipline rate table
Route::set('teacher:rating', '<type>/<id>', ['type' => '(rate|exam)', 'id' => '[0-9]+']) Route::set('teacher:rating', '<type>/<id>', ['type' => '(rate|exam|history)', 'id' => '[0-9]+'])
->defaults(array( ->defaults([
'directory' => 'teacher', 'directory' => 'teacher',
'controller' => 'rating', 'controller' => 'rating',
'action' => 'rate' 'action' => 'rate'
)); ]);
// --------------- Администрирование ---------------- // --------------- Администрирование ----------------
Route::set('admin:common', 'admin(/<controller>(/<action>(/<param1>(:<param2>))))') Route::set('admin:common', 'admin(/<controller>(/<action>(/<param1>(:<param2>))))')
......
...@@ -19,8 +19,7 @@ class Controller_Teacher_Rating extends Controller_Environment_Teacher ...@@ -19,8 +19,7 @@ class Controller_Teacher_Rating extends Controller_Environment_Teacher
} }
private static function getTitle($pageType, $try, &$module) private static function getTitle($pageType, $try, &$module) {
{
if ($pageType == 'rate') { if ($pageType == 'rate') {
$title = $module['SubmoduleName']; $title = $module['SubmoduleName'];
} else if ($module['ModuleType'] == 'extra') { } else if ($module['ModuleType'] == 'extra') {
...@@ -142,7 +141,7 @@ class Controller_Teacher_Rating extends Controller_Environment_Teacher ...@@ -142,7 +141,7 @@ class Controller_Teacher_Rating extends Controller_Environment_Teacher
foreach ($rateList as $curRate) { foreach ($rateList as $curRate) {
$moduleType = $curRate['ModuleType']; $moduleType = $curRate['ModuleType'];
if ( $moduleType == 'exam' || $moduleType == 'extra' ) { if ($moduleType == 'exam' || $moduleType == 'extra') {
$curStudent['Rates'][$rowIndex] = [ $curStudent['Rates'][$rowIndex] = [
'SubmoduleID' => $curRate['SubmoduleID'], 'SubmoduleID' => $curRate['SubmoduleID'],
'Rate' => $curRate['Rate'], 'Rate' => $curRate['Rate'],
...@@ -153,7 +152,7 @@ class Controller_Teacher_Rating extends Controller_Environment_Teacher ...@@ -153,7 +152,7 @@ class Controller_Teacher_Rating extends Controller_Environment_Teacher
$points = $curRate['Rate']; $points = $curRate['Rate'];
switch ( $moduleType ) { switch ($moduleType) {
case 'regular': case 'regular':
$curStudent['RateSemesterResult'] += $points; $curStudent['RateSemesterResult'] += $points;
break; break;
...@@ -208,13 +207,24 @@ class Controller_Teacher_Rating extends Controller_Environment_Teacher ...@@ -208,13 +207,24 @@ class Controller_Teacher_Rating extends Controller_Environment_Teacher
$this->correctExtra($curStudent, $examType, $lastExtraIndex, $firstEmptyExtra, $rateExtra); $this->correctExtra($curStudent, $examType, $lastExtraIndex, $firstEmptyExtra, $rateExtra);
} }
private function showRatingHistory($disciplineID) {
$this->twig->set([
'log' => Model_Rating::getHistory($disciplineID),
])->set_filename('teacher/history');
}
/** /**
* @param $page_type : rating, exam
* @throws HTTP_Exception * @throws HTTP_Exception
*/ */
protected function action_rate() { protected function action_rate() {
$id = $this->request->param('id'); $id = $this->request->param('id');
$pageType = $this->request->param('type'); // 'rate', 'exam' $pageType = $this->request->param('type'); // 'rate', 'exam', 'history'
if ($pageType == 'history') {
$this->showRatingHistory($id);
return;
}
$discipline = Model_Discipline::load($id); $discipline = Model_Discipline::load($id);
$discipline['GroupID_Filter'] = $this->getFilterGroupID($id); $discipline['GroupID_Filter'] = $this->getFilterGroupID($id);
...@@ -261,6 +271,4 @@ class Controller_Teacher_Rating extends Controller_Environment_Teacher ...@@ -261,6 +271,4 @@ class Controller_Teacher_Rating extends Controller_Environment_Teacher
])->set_filename("teacher/" . $twigType); ])->set_filename("teacher/" . $twigType);
} }
} }
\ No newline at end of file
...@@ -105,6 +105,13 @@ class Model_Rating extends Model ...@@ -105,6 +105,13 @@ class Model_Rating extends Model
return (int) $res->get('res'); return (int) $res->get('res');
} }
public static function getHistory($discipline) {
$sql = "CALL `GetRatesHistory`(:discipline)";
return DB::query(Database::SELECT, $sql)
->param(':discipline', $discipline)
->execute();
}
public static function setExamPeriodOption($student, $submodule, $option) { public static function setExamPeriodOption($student, $submodule, $option) {
// option is absence or pass or null // option is absence or pass or null
$sql = "SELECT `SetExamPeriodOption`(:student, :submodule, :option) As `ErrorCode`"; $sql = "SELECT `SetExamPeriodOption`(:student, :submodule, :option) As `ErrorCode`";
......
{# TODO: user interface #}
<html>
<body>
<pre>
{{ Text.dump(logs) }}
</pre>
</body>
</html>
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