Fix score in grid see BT#13187

pull/2487/head
jmontoyaa 7 years ago
parent 5fd6a22958
commit 851938433a
  1. 17
      main/inc/ajax/model.ajax.php
  2. 18
      main/inc/lib/exercise.lib.php

@ -1246,31 +1246,33 @@ switch ($action) {
'session',
'session_access_start_date',
'exe_date',
'score_percentange',
'score_percentage',
'only_score',
'total'
);
$overwriteColumnHeaderExport['session_access_start_date'] = get_lang('SessionStartDate');
$overwriteColumnHeaderExport['exe_date'] = get_lang('StartDate');
$overwriteColumnHeaderExport['score_percentange'] = get_lang('Score');
$overwriteColumnHeaderExport['score_percentage'] = get_lang('Score');
$overwriteColumnHeaderExport['only_score'] = get_lang('Score');
$overwriteColumnHeaderExport['total'] = get_lang('Score');
}
$categoryList = TestCategory::getListOfCategoriesIDForTest($exerciseId, $courseId);
if (!empty($categoryList)) {
foreach ($categoryList as $categoryInfo) {
$label = 'category_'.$categoryInfo['id'];
//$columns[] = $label;
$columns[] = $label.'_score_percentange';
$columns[] = $label.'_only_score';
$columns[] = $label.'_total';
if ($operation == 'excel') {
$columns[] = $label.'_score_percentage';
$columns[] = $label.'_only_score';
$columns[] = $label.'_total';
$overwriteColumnHeaderExport[$label] = $categoryInfo['title'];
$overwriteColumnHeaderExport[$label.'_score_percentange'] = $categoryInfo['title'];
$overwriteColumnHeaderExport[$label.'_score_percentage'] = $categoryInfo['title'];
$overwriteColumnHeaderExport[$label.'_only_score'] = $categoryInfo['title'];
$overwriteColumnHeaderExport[$label.'_total'] = $categoryInfo['title'];
} else {
$columns[] = $label;
}
}
}
@ -1278,6 +1280,7 @@ switch ($action) {
if ($operation !== 'excel') {
$columns[] = 'actions';
}
$result = ExerciseLib::get_exam_results_data(
$start,
$limit,

@ -1676,6 +1676,8 @@ HOTSPOT;
* @param null $extra_where_conditions
* @param bool $get_count
* @param string $courseCode
* @param bool $showSessionField
* @param bool $showExerciseCategories
*
* @return array
*/
@ -1939,7 +1941,7 @@ HOTSPOT;
}
}
$list_info = array();
$listInfo = array();
// Simple exercises
if (empty($hotpotatoe_where)) {
@ -2317,7 +2319,7 @@ HOTSPOT;
foreach ($category_list as $categoryId => $result) {
$scoreToDisplay = self::show_score($result['score'], $result['total']);
$results[$i]['category_'.$categoryId] = $scoreToDisplay;
$results[$i]['category_'.$categoryId.'_score_percentange'] = self::show_score(
$results[$i]['category_'.$categoryId.'_score_percentage'] = self::show_score(
$result['score'],
$result['total'],
true,
@ -2332,7 +2334,7 @@ HOTSPOT;
$results[$i]['session_access_start_date'] = $sessionStartAccessDate;
$results[$i]['status'] = $revisedLabel;
$results[$i]['score'] = $score;
$results[$i]['score_percentange'] = self::show_score(
$results[$i]['score_percentage'] = self::show_score(
$my_res,
$my_total,
true,
@ -2344,12 +2346,12 @@ HOTSPOT;
$results[$i]['total'] = $my_total;
$results[$i]['lp'] = $lp_name;
$results[$i]['actions'] = $actions;
$list_info[] = $results[$i];
$listInfo[] = $results[$i];
} else {
$results[$i]['status'] = $revisedLabel;
$results[$i]['score'] = $score;
$results[$i]['actions'] = $actions;
$list_info[] = $results[$i];
$listInfo[] = $results[$i];
}
}
}
@ -2384,7 +2386,7 @@ HOTSPOT;
$hp_result .= '% ('.$hpresults[$i][4].' / '.$hpresults[$i][5].')';
if ($is_allowedToEdit) {
$list_info[] = array(
$listInfo[] = array(
$hpresults[$i][0],
$hpresults[$i][1],
$hpresults[$i][2],
@ -2396,7 +2398,7 @@ HOTSPOT;
'-'
);
} else {
$list_info[] = array(
$listInfo[] = array(
$hp_title,
'-',
$hp_date,
@ -2408,7 +2410,7 @@ HOTSPOT;
}
}
return $list_info;
return $listInfo;
}
/**

Loading…
Cancel
Save