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

exam

parent befb1b64
Branches
Tags
No related merge requests found
...@@ -148,17 +148,18 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { ...@@ -148,17 +148,18 @@ class Controller_Teacher_Rating extends Controller_UserEnvi {
$structureHandled = array(); $structureHandled = array();
$maxRate = 0; $i = 1; $module = 0; $try_1 = 0; // try = 1 - экзамен, = 2, 3 - пересдачи $maxRate = 0; $i = 0; $module = 0; $try_1 = 0; // try = 1 - экзамен, = 2, 3 - пересдачи
$examRate = 0;
foreach($structure as $row) foreach($structure as $row)
{ {
//if($row['ModuleID'] != $module) if($row['ModuleID'] != $module)
//{ {
// $i = 1; ++$i;
// $module = $row['ModuleID']; $module = $row['ModuleID'];
//} }
//if ($i == 1) if ($i == 1)
// $twig->SubjectName = $row['SubjectName']; $twig->SubjectName = $row['SubjectName'];
if(!isset($structureHandled[$i]['SubmodulesCount'])) if(!isset($structureHandled[$i]['SubmodulesCount']))
{ {
$structureHandled[$i]['SubmodulesCount'] = 0; $structureHandled[$i]['SubmodulesCount'] = 0;
...@@ -172,17 +173,18 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { ...@@ -172,17 +173,18 @@ class Controller_Teacher_Rating extends Controller_UserEnvi {
$twig->examSubmoduleID = $row['SubmoduleID']; $twig->examSubmoduleID = $row['SubmoduleID'];
$structureHandled[$i][$j]['SubmoduleID'] = $row['SubmoduleID']; $structureHandled[$i][$j]['SubmoduleID'] = $row['SubmoduleID'];
if ($row['ModuleType'] == 'extra') if ($row['ModuleType'] == 'extra') {
$structureHandled[$i][$j]['Title'] = 'Добор баллов'; $structureHandled[$i][$j]['Title'] = 'Добор баллов';
$maxRate += $row['MaxRate'];
}
else { else {
$try++; $try++;
if ($try > 1) $examRate = $row['MaxRate'];
$structureHandled[$i][$j]['Title'] = 'Пересдача '.($try - 1); $structureHandled[$i][$j]['Title'] = 'Пересдача '.$try;
else $structureHandled[$i][$j]['Title'] = 'Экзамен';
} }
//$structureHandled[$i][$j]['Description'] = $row['SubmoduleDescription']; // Описание //$structureHandled[$i][$j]['Description'] = $row['SubmoduleDescription']; // Описание
$structureHandled[$i][$j]['MaxRate'] = (int) $row['MaxRate']; $structureHandled[$i][$j]['MaxRate'] = (int) $row['MaxRate'];
$maxRate += $row['MaxRate'];
} }
$structureHandled['ModulesCount'] = $i; $structureHandled['ModulesCount'] = $i;
$structureHandled['MaxRate'] = (int) $maxRate; $structureHandled['MaxRate'] = (int) $maxRate;
...@@ -198,7 +200,7 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { ...@@ -198,7 +200,7 @@ class Controller_Teacher_Rating extends Controller_UserEnvi {
$i_g = 0; $i_s = 0; $curGroup = 0; $i_g = 0; $i_s = 0; $curGroup = 0;
foreach($students as $row) { foreach($students as $row) {
// Группа // Группа
if ($curGroup !== $row['GroupID']) { if ($curGroup !== $row['GroupID']) {
$curGroup = $row['GroupID']; $curGroup = $row['GroupID'];
$i_g++; $i_g++;
...@@ -230,12 +232,21 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { ...@@ -230,12 +232,21 @@ class Controller_Teacher_Rating extends Controller_UserEnvi {
$rate = $db->getMapForStudentExam($row['ID'], $id); $rate = $db->getMapForStudentExam($row['ID'], $id);
$i_r = 0; $i_r = 0;
$rateHandled[$i_g]['Students'][$i_s]['RateResult'] = 0; $rateHandled[$i_g]['Students'][$i_s]['RateResult'] = 0;
$examRate = 0;
foreach($rate as $r) { foreach($rate as $r) {
$i_r++; $i_r++;
if ($r['ModuleType'] == 'exam') {
if (!is_null($r['Rate']))
$examRate = $r['Rate'];
} else {
$rateHandled[$i_g]['Students'][$i_s]['RateResult'] += $r['Rate'];
}
$rateHandled[$i_g]['Students'][$i_s]['Rates'][$i_r]['SubmoduleID'] = $r['SubmoduleID']; $rateHandled[$i_g]['Students'][$i_s]['Rates'][$i_r]['SubmoduleID'] = $r['SubmoduleID'];
$rateHandled[$i_g]['Students'][$i_s]['Rates'][$i_r]['Rate'] = $r['Rate']; $rateHandled[$i_g]['Students'][$i_s]['Rates'][$i_r]['Rate'] = $r['Rate'];
$rateHandled[$i_g]['Students'][$i_s]['RateResult'] += $r['Rate'];
} }
$rateHandled[$i_g]['Students'][$i_s]['RateResult'] += $examRate;
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<tr class="RatingTableModulesHead"> <tr class="RatingTableModulesHead">
<td class="title" width="150px">Модуль</td> <td class="title" width="150px">Модуль</td>
{% for i in 1..headerRate.ModulesCount %} {% for i in 1..headerRate.ModulesCount %}
<td class="subject {% if headerRate[i].ModuleType == 'bonus' %} bonus{% endif %}" colspan="{{headerRate[i].SubmodulesCount}}"> <td class="subject" colspan="{{headerRate[i].SubmodulesCount}}" {% if headerRate[i].ModuleType != 'exam' %} rowspan="2" {% endif %}>
{{ headerRate[i].ModuleTitle }} {{ headerRate[i].ModuleTitle }}
</td> </td>
{% endfor %} {% endfor %}
......
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