Add min to validate parameter in condition see BT#13099

pull/2487/head
jmontoyaa 8 years ago
parent df4d232638
commit a417ff33b3
  1. 16
      user_portal.php

@ -347,7 +347,8 @@ if (!empty($courseAndSessions['courses']) && $allow) {
$total[$category->get_course_code()] = [
'score' => $parentScore,
'total_score_with_children' => api_number_format($totalScoreWithChildrenAverage),
'children' => $children
'children' => $children,
'min_validated' => $category->getMinimumToValidate()
];
}
@ -356,8 +357,21 @@ if (!empty($courseAndSessions['courses']) && $allow) {
$maxPercentage = 80;
$maxCustomPercentageCounter = 0;
$validatedCoursesPercentage = 0;
$countValidated = 0;
foreach ($total as $courseCode => $data) {
$totalScoreWithChildren = $data['total_score_with_children'];
if ($totalScoreWithChildren == 100) {
$countValidated++;
}
}
foreach ($total as $courseCode => $data) {
$totalScoreWithChildren = $data['total_score_with_children'];
if ($data['min_validated'] < $countValidated) {
$totalScoreWithChildren = 0;
}
if (in_array($courseCode, $mandatoryCourse)) {
if ($totalScoreWithChildren == 100) {
$finalScore = 0;

Loading…
Cancel
Save