Skip to content

Commit

Permalink
Exercise: Fix column order BT#15636
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Oct 2, 2019
1 parent 0efff79 commit d10a8be
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions main/exercise/exercise.class.php
Expand Up @@ -8314,7 +8314,6 @@ public function generateStats($exerciseId, $courseInfo, $sessionId)
$studentCount = 0;
$sum = 0;
$bestResult = 0;
$weight = 0;
$sumResult = 0;
$result = Database::query($sql);
while ($data = Database::fetch_array($result, 'ASSOC')) {
Expand All @@ -8328,13 +8327,10 @@ public function generateStats($exerciseId, $courseInfo, $sessionId)
if (!isset($students[$data['exe_user_id']])) {
if ($data['exe_weighting'] != 0) {
$students[$data['exe_user_id']] = $data['exe_result'];
$studentCount++;
if ($data['exe_result'] > $bestResult) {
$bestResult = $data['exe_result'];
}
$sum += $data['exe_result'] / $data['exe_weighting'];
$sumResult += $data['exe_result'];
$weight = $data['exe_weighting'];
}
}
}
Expand Down Expand Up @@ -8429,10 +8425,14 @@ public static function exerciseGrid($categoryId, $keyword = '')
// Condition for the session
$condition_session = api_get_session_condition($sessionId, true, true);
$content = '';
$column = 0;
if ($is_allowedToEdit) {
$column = 1;
}

$table = new SortableTableFromArrayConfig(
[],
1,
$column,
self::PAGINATION_ITEMS_PER_PAGE,
'exercises_cat_'.$categoryId
);
Expand Down Expand Up @@ -9358,7 +9358,6 @@ public static function exerciseGrid($categoryId, $keyword = '')
if (empty($tableRows)) {
return '';
}

$table->setTableData($tableRows);
$table->setTotalNumberOfItems($total);
$table->set_additional_parameters([
Expand Down

0 comments on commit d10a8be

Please sign in to comment.