From 6d34a02cbd635c660b5aee7bd4e85f0d0de6c975 Mon Sep 17 00:00:00 2001
From: PavelBegunkov <asml.Silence@gmail.com>
Date: Tue, 16 Dec 2014 22:43:50 +0300
Subject: [PATCH] fix6

---
 .../classes/Controller/Teacher/Rating.php     |  6 +--
 .../application/views/teacher/exam.twig       | 48 +++++--------------
 2 files changed, 14 insertions(+), 40 deletions(-)

diff --git a/~dev_rating/application/classes/Controller/Teacher/Rating.php b/~dev_rating/application/classes/Controller/Teacher/Rating.php
index 4a2f4d75e..99a51a062 100644
--- a/~dev_rating/application/classes/Controller/Teacher/Rating.php
+++ b/~dev_rating/application/classes/Controller/Teacher/Rating.php
@@ -250,8 +250,6 @@ class Controller_Teacher_Rating extends Controller_UserEnvi {
                 } else {
                     $extraNum = $i_r;
                     $rateHandled[$i_g]['Students'][$i_s]['RateResult'] += $r['Rate']; 
-                    $i_r++;
-                    $rateHandled[$i_g]['Students'][$i_s]['RateResult'] = $r['Rate']; 
                 }
             }
             $rateHandled[$i_g]['Students'][$i_s]['RateResult'] += $examRate;
@@ -262,9 +260,9 @@ class Controller_Teacher_Rating extends Controller_UserEnvi {
             $rateHandled[$i_g]['Students'][$i_s]['Rates'][$extraNum+1]['SubmoduleID'] = -1;
             $curRate = $total[0]['Num'] - $examRate - $rateHandled[$i_g]['Students'][$i_s]['Rates'][$extraNum+1]['Rate'];
             if ($curRate < 32 OR $curRate > 38)
-                $rateHandled[$i_g]['Students'][$i_s]['Rates'][$extraNum+1]['Rate'] = 0; 
+                $rateHandled[$i_g]['Students'][$i_s]['Extra'] = 0; 
             else
-                $rateHandled[$i_g]['Students'][$i_s]['Rates'][$extraNum+1]['Rate'] = 38 - $curRate;
+                $rateHandled[$i_g]['Students'][$i_s]['Extra'] = 38 - $curRate;
         }
 
         //echo Debug::vars($structureHandled,$rateHandled);
diff --git a/~dev_rating/application/views/teacher/exam.twig b/~dev_rating/application/views/teacher/exam.twig
index 52987eb2e..9dde8a490 100644
--- a/~dev_rating/application/views/teacher/exam.twig
+++ b/~dev_rating/application/views/teacher/exam.twig
@@ -25,18 +25,12 @@
 	<table class="studentsRate" border="0" cellspacing="0" cellpadding="0">
 		<tr class="RatingTableModulesHead">
 			<td class="title" width="150px">Модуль</td>
+			<td class="subject" rowspan="3">Итог за семестр</td>
 			{% for i in 1..headerRate.ModulesCount %}
-				{% if headerRate[i].ModuleType == 'extra' %}
-					<td class="subject" colspan="2">
-						{{ headerRate[i].ModuleTitle }}
-					</td>
-				{% else %}
-					<td class="subject" colspan="{{headerRate[i].SubmodulesCount}}">
-						{{ headerRate[i].ModuleTitle }}
-					</td>
-				{% endif %}
+				<td class="subject" colspan="{{headerRate[i].SubmodulesCount}}">
+					{{ headerRate[i].ModuleTitle }}
+				</td>
 			{% endfor %}
-			<td class="subject" rowspan="3">Итог за семестр</td>
 			<td class="subject" rowspan="3">Итог</td>
 		</tr>
 		<tr class="RatingTableSubmodulesHead">
@@ -44,23 +38,12 @@
 			{% set col = 0 %}
 			<td class="title">Мероприятие</td>
 			{% for i in 1..headerRate.ModulesCount %}
-					{% if headerRate[i].ModuleType == 'extra' %}
-						{% set CellCount = CellCount + headerRate[i].SubmodulesCount %}
-						{% for j in 1..headerRate[i].SubmodulesCount %}
-							{% set col = col + 1 %}
-							<td class="subject col_{{ col }}"> - </td>
-						{% endfor %}
-						{% set col = col + 1 %}
-						<td class="subject col_{{ col }}">{{ "Макс." }}</td>
-					{% else %}
-						{% set CellCount = CellCount + headerRate[i].SubmodulesCount %}
-						{% for j in 1..headerRate[i].SubmodulesCount %}
-							{% set col = col + 1 %}
-							<td class="subject col_{{ col }}">{{ headerRate[i][j].Title }}</td>
-						{% endfor %}
-
-					{% endif %}
-				
+				{% set CellCount = CellCount + headerRate[i].SubmodulesCount %}
+				{% for j in 1..headerRate[i].SubmodulesCount %}
+					{% set col = col + 1 %}
+					<td class="subject col_{{ col }}"> - </td>
+				{% endfor %}
+				{% set col = col + 1 %}
 			{% endfor %}
 		</tr>
 		<tr class="RatingTableSubmodulesHeadMaxRate">
@@ -75,13 +58,6 @@
 						<input type="hidden" class="MaxRate" value="{{ headerRate[i][j].MaxRate }}">
 					</td>
 				{% endfor %}
-				{% if headerRate[i].ModuleType == 'extra' %}
-					{% set CellCount = CellCount + 1 %}
-					{% set col = col + 1 %}
-					<td class="subject col_{{ col }}" id="{{ headerRate[i][j].SubmoduleID }}"> -
-						<input type="hidden" class="MaxRate" value="-">
-					</td>
-				{% endif %}
 			{% endfor %}
 		</tr>
 		{% set row = 0 %}
@@ -93,6 +69,7 @@
 				{% set row = row + 1 %}
 				{% set j = 0 %}
 				<tr id="{{ row }}" class="{{ group.GroupID }}">
+					<td class="row_{{ row }} col_{{ i + 1 }} RateSemesterResult">{{ student.RateSemesterResult }}</td>
 					<td class="student" id="{{ student.ID }}">{{ student.Last }} {{ student.First }}</td>
 					{% for i in 1..CellCount %}
 						{% set j = j + 1 %}
@@ -100,8 +77,7 @@
 							<input type="text" value="{{ student.Rates[i].Rate }}">
 						</td>
 					{% endfor %}
-					<td class="row_{{ row }} col_{{ i + 1 }} RateSemesterResult">{{ student.RateSemesterResult }}</td>
-					<td class="row_{{ row }} col_{{ i + 2 }} RateResult">{{ student.RateResult }}</td>
+					<td class="row_{{ row }} col_{{ i + 1 }} RateResult">{{ student.RateResult }}</td>
 				</tr>
 			{% endfor %}
 		{% endfor %}
-- 
GitLab