Fixes after merge with 1.11.x

pull/3006/head
Julio Montoya 5 years ago
parent 6ea07d20c7
commit 25e2f3cb67
  1. 6
      main/exercise/overview.php
  2. 4
      main/exercise/recalculate.php
  3. 6
      main/gradebook/lib/be/exerciselink.class.php
  4. 2
      main/gradebook/lib/fe/displaygradebook.php
  5. 2
      main/gradebook/lib/fe/gradebooktable.class.php
  6. 12
      main/inc/lib/exercise.lib.php

@ -215,8 +215,8 @@ if (!empty($attempts)) {
foreach ($attempts as $attempt_result) { foreach ($attempts as $attempt_result) {
if (empty($certificateBlock)) { if (empty($certificateBlock)) {
$certificateBlock = ExerciseLib::generateAndShowCertificateBlock( $certificateBlock = ExerciseLib::generateAndShowCertificateBlock(
$attempt_result['exe_result'], $attempt_result['score'],
$attempt_result['exe_weighting'], $attempt_result['max_score'],
$objExercise, $objExercise,
$attempt_result['exe_user_id'], $attempt_result['exe_user_id'],
$courseCode, $courseCode,
@ -224,7 +224,7 @@ if (!empty($attempts)) {
); );
} }
$score = ExerciseLib::show_score($attempt_result['exe_result'], $attempt_result['exe_weighting']); $score = ExerciseLib::show_score($attempt_result['score'], $attempt_result['max_score']);
$attempt_url = api_get_path(WEB_CODE_PATH).'exercise/result.php?'; $attempt_url = api_get_path(WEB_CODE_PATH).'exercise/result.php?';
$attempt_url .= api_get_cidreq().'&show_headers=1&'; $attempt_url .= api_get_cidreq().'&show_headers=1&';
$attempt_url .= http_build_query(['id' => $attempt_result['exe_id']]); $attempt_url .= http_build_query(['id' => $attempt_result['exe_id']]);

@ -116,8 +116,8 @@ if (!$useEvaluationPlugin) {
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$sql = "UPDATE $table SET $sql = "UPDATE $table SET
exe_result = '$totalScore', score = '$totalScore',
exe_weighting = '$totalWeight' max_score = '$totalWeight'
WHERE exe_id = $exeId"; WHERE exe_id = $exeId";
Database::query($sql); Database::query($sql);

@ -362,11 +362,11 @@ class ExerciseLink extends AbstractLink
if ($data['max_score'] != 0) { if ($data['max_score'] != 0) {
$students[$data['exe_user_id']] = $data['score']; $students[$data['exe_user_id']] = $data['score'];
$student_count++; $student_count++;
if ($data['exe_result'] > $bestResult) { if ($data['score'] > $bestResult) {
$bestResult = $data['exe_result']; $bestResult = $data['score'];
} }
$sum += $data['score'] / $data['max_score']; $sum += $data['score'] / $data['max_score'];
$sumResult += $data['exe_result']; $sumResult += $data['score'];
$weight = $data['max_score']; $weight = $data['max_score'];
} }
} }

@ -523,7 +523,7 @@ class DisplayGradebook
} }
$score_display_custom = api_get_setting('gradebook_score_display_custom'); $score_display_custom = api_get_setting('gradebook_score_display_custom');
if (api_get_setting('teachers_can_change_score_settings') == 'true' && if (api_get_setting('teachers_can_change_score_settings') == 'true' &&
$score_display_custom['my_display_custom'] == 'true' $score_display_custom == 'true'
) { ) {
$actionsRight .= '<a href="gradebook_scoring_system.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'. $actionsRight .= '<a href="gradebook_scoring_system.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
Display::return_icon('ranking.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('ranking.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM).'</a>';

@ -919,7 +919,7 @@ class GradebookTable extends SortableTable
$content_html = DocumentManager::replace_user_info_into_html( $content_html = DocumentManager::replace_user_info_into_html(
api_get_user_id(), api_get_user_id(),
$course_code, api_get_course_info(),
api_get_session_id() api_get_session_id()
); );

@ -4965,8 +4965,8 @@ EOT;
usort( usort(
$data, $data,
function ($a, $b) { function ($a, $b) {
if ($a['exe_result'] != $b['exe_result']) { if ($a['score'] != $b['score']) {
return $a['exe_result'] > $b['exe_result'] ? -1 : 1; return $a['score'] > $b['score'] ? -1 : 1;
} }
if ($a['exe_date'] != $b['exe_date']) { if ($a['exe_date'] != $b['exe_date']) {
@ -4978,21 +4978,21 @@ EOT;
); );
// flags to display the same position in case of tie // flags to display the same position in case of tie
$lastScore = $data[0]['exe_result']; $lastScore = $data[0]['score'];
$position = 1; $position = 1;
$data = array_map( $data = array_map(
function ($item) use (&$lastScore, &$position) { function ($item) use (&$lastScore, &$position) {
if ($item['exe_result'] < $lastScore) { if ($item['score'] < $lastScore) {
$position++; $position++;
} }
$lastScore = $item['exe_result']; $lastScore = $item['score'];
return [ return [
$position, $position,
api_get_user_entity($item['exe_user_id']), api_get_user_entity($item['exe_user_id']),
self::show_score($item['exe_result'], $item['exe_weighting'], true, true, true), self::show_score($item['score'], $item['max_score'], true, true, true),
api_convert_and_format_date($item['exe_date'], DATE_TIME_FORMAT_SHORT), api_convert_and_format_date($item['exe_date'], DATE_TIME_FORMAT_SHORT),
]; ];
}, },

Loading…
Cancel
Save