| @@ 1040-1066 (lines=27) @@ | ||
| 1037 | $weightsum = 0; |
|
| 1038 | $bestResult = 0; |
|
| 1039 | ||
| 1040 | if (!empty($cats)) { |
|
| 1041 | /** @var Category $cat */ |
|
| 1042 | foreach ($cats as $cat) { |
|
| 1043 | $cat->setStudentList($this->getStudentList()); |
|
| 1044 | $score = $cat->calc_score( |
|
| 1045 | null, |
|
| 1046 | $type, |
|
| 1047 | $course_code, |
|
| 1048 | $session_id |
|
| 1049 | ); |
|
| 1050 | ||
| 1051 | $catweight = 0; |
|
| 1052 | if ($cat->get_weight() != 0) { |
|
| 1053 | $catweight = $cat->get_weight(); |
|
| 1054 | $weightsum += $catweight; |
|
| 1055 | } |
|
| 1056 | ||
| 1057 | if (isset($score) && !empty($score[1]) && !empty($catweight)) { |
|
| 1058 | $ressum += $score[0] / $score[1] * $catweight; |
|
| 1059 | ||
| 1060 | if ($ressum > $bestResult) { |
|
| 1061 | $bestResult = $ressum; |
|
| 1062 | } |
|
| 1063 | } |
|
| 1064 | ||
| 1065 | } |
|
| 1066 | } |
|
| 1067 | ||
| 1068 | if (!empty($evals)) { |
|
| 1069 | /** @var Evaluation $eval */ |
|
| @@ 945-968 (lines=24) @@ | ||
| 942 | $ressum = 0; |
|
| 943 | $weightsum = 0; |
|
| 944 | ||
| 945 | if (!empty($cats)) { |
|
| 946 | /** @var Category $cat */ |
|
| 947 | foreach ($cats as $cat) { |
|
| 948 | $cat->set_session_id($session_id); |
|
| 949 | $cat->set_course_code($course_code); |
|
| 950 | $cat->setStudentList($this->getStudentList()); |
|
| 951 | $score = $cat->calc_score( |
|
| 952 | $stud_id, |
|
| 953 | null, |
|
| 954 | $course_code, |
|
| 955 | $session_id |
|
| 956 | ); |
|
| 957 | ||
| 958 | $catweight = 0; |
|
| 959 | if ($cat->get_weight() != 0) { |
|
| 960 | $catweight = $cat->get_weight(); |
|
| 961 | $weightsum += $catweight; |
|
| 962 | } |
|
| 963 | ||
| 964 | if (isset($score) && !empty($score[1]) && !empty($catweight)) { |
|
| 965 | $ressum += $score[0] / $score[1] * $catweight; |
|
| 966 | } |
|
| 967 | } |
|
| 968 | } |
|
| 969 | ||
| 970 | $students = array(); |
|
| 971 | if (!empty($evals)) { |
|